From: vsr Date: Mon, 10 Jan 2005 09:04:06 +0000 (+0000) Subject: Improve Python editor (including fixing PAL7231) as follows: X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dcb7d40d4de8d5500415e182020655fba3e43ae6;p=modules%2Fkernel.git Improve Python editor (including fixing PAL7231) as follows: 1) process keyboard actions for the following keys: , , , , , , , , , , with different key-modifiers like , . 2) process pasting of selected text to the command line by middle-button mouse click (works also for external selection). 3) process drop event: paste dragged text to the command line. See PAL7231 additional comments from 10/01/05 for more details. --- diff --git a/src/SALOMEGUI/PyInterp_base.cxx b/src/SALOMEGUI/PyInterp_base.cxx index ddc56b875..199381a54 100644 --- a/src/SALOMEGUI/PyInterp_base.cxx +++ b/src/SALOMEGUI/PyInterp_base.cxx @@ -248,11 +248,17 @@ int PyInterp_base::run(const char *command) { if(_atFirst){ int ret = 0; - _atFirst = false; ret = simpleRun("from Help import *"); - if (ret) return ret; + if (ret) { + _atFirst = false; + return ret; + } ret = simpleRun("import salome"); - if (ret) return ret; + if (ret) { + _atFirst = false; + return ret; + } + _atFirst = false; } return simpleRun(command); } @@ -260,7 +266,7 @@ int PyInterp_base::run(const char *command) int PyInterp_base::simpleRun(const char *command) { - if(strcmp(command,"") != 0){ + if( !_atFirst && strcmp(command,"") != 0 ) { _history.push_back(command); _ith = _history.end(); } diff --git a/src/SALOMEGUI/QAD_PyEditor.cxx b/src/SALOMEGUI/QAD_PyEditor.cxx index ab17fc756..bfd4ec997 100644 --- a/src/SALOMEGUI/QAD_PyEditor.cxx +++ b/src/SALOMEGUI/QAD_PyEditor.cxx @@ -38,6 +38,7 @@ #include #include #include +#include // NRI : Temporary added // IDL Headers @@ -57,12 +58,12 @@ static int MYDEBUG = 0; #endif -#define SIZEPR 4 enum { IdCopy, IdPaste, IdClear, IdSelectAll }; -static QString PROMPT = ">>> "; - +static QString READY_PROMPT = ">>> "; +static QString DOTS_PROMPT = "... "; +#define PROMPT_SIZE _currentPrompt.length() class TInitEditorThread : public QThread { @@ -135,7 +136,7 @@ protected: if(MYDEBUG) MESSAGE("TExecCommand::run() - myInterp = "< 0) + else if(ret > 0) anId = QAD_PyEditor::PYTHON_INCOMPLETE; myListener->myError = myInterp->getverr().c_str(); myListener->myOutput = myInterp->getvout().c_str(); @@ -182,7 +183,7 @@ QAD_PyEditor::QAD_PyEditor(QAD_PyInterp*& theInterp, QMutex* theMutex, myInitEditorThread = new TInitEditorThread(myInterp,myStudyMutex,myInitEditorMutex,this); myExecCommandThread = new TExecCommandThread(myInterp,myStudyMutex,myExecCommandMutex,this); - _currentPrompt = PROMPT; + _currentPrompt = READY_PROMPT; setPalette( QAD_Application::getPalette(true) ); setWordWrap(NoWrap); @@ -235,7 +236,6 @@ void QAD_PyEditor::setText(QString s) */ void QAD_PyEditor::handleReturn() { - int ret; int para=paragraphs()-2; // NRI : Temporary added @@ -248,24 +248,78 @@ void QAD_PyEditor::handleReturn() QObject::tr("WRN_STUDY_LOCKED"), QObject::tr("BUT_OK") ); - _currentPrompt = ">>> "; + _currentPrompt = READY_PROMPT; setText(_currentPrompt); return; } // NRI - _buf.append(text(para).remove(0,SIZEPR)); + _buf.append(text(para).remove(0,PROMPT_SIZE)); _buf.truncate( _buf.length() - 1 ); setReadOnly( true ); viewport()->setCursor( waitCursor ); myExecCommandThread->exec(_buf.latin1()); } +/* + Processes drop event: paste dragged text +*/ +void QAD_PyEditor::contentsDropEvent( QDropEvent* event ) +{ + event->acceptAction(); + QString text; + if ( QTextDrag::decode( event, text ) ) { + int par, col; + int endLine = paragraphs() -1; + col = charAt( event->pos(), &par ); + + if ( col >= 0 && par >= 0 ) { + if ( par != endLine || col < PROMPT_SIZE ) { + par = endLine; + col = paragraphLength( endLine ); + } + setCursorPosition( par, col ); + insertAt( text, par, col ); + removeSelection(); + } + } +} + +/* + Processes middle button release event - paste clipboard's contents +*/ +void QAD_PyEditor::contentsMouseReleaseEvent( QMouseEvent* event ) +{ + if ( event->button() == LeftButton ) { + QTextEdit::contentsMouseReleaseEvent(event); + copy(); + } + if ( event->button() == MidButton ) { + if (QApplication::clipboard()->supportsSelection()) { + int par, col; + int endLine = paragraphs() -1; + col = charAt( event->pos(), &par ); + if ( col >= 0 && par >= 0 ) { + if ( par != endLine || col < PROMPT_SIZE ) + setCursorPosition( endLine, paragraphLength( endLine ) ); + else + setCursorPosition( par, col ); + QApplication::clipboard()->setSelectionMode(TRUE); + paste(); + QApplication::clipboard()->setSelectionMode(FALSE); + } + } + } + else { + QTextEdit::contentsMouseReleaseEvent(event); + } +} + /* Processes own popup menu */ -void QAD_PyEditor::mousePressEvent (QMouseEvent * event) +void QAD_PyEditor::mousePressEvent (QMouseEvent* event) { if ( event->button() == RightButton ) { QPopupMenu *popup = new QPopupMenu( this ); @@ -303,260 +357,372 @@ void QAD_PyEditor::mousePressEvent (QMouseEvent * event) else if ( r == idMap[ IdClear ] ) { clear(); setText(myBanner); + _currentPrompt = READY_PROMPT; setText(_currentPrompt); } else if ( r == idMap[ IdSelectAll ] ) { selectAll(); } - return; } else { QTextEdit::mousePressEvent(event); } } -/*! - Called when any event occures. The function is redefined to handle MousePress events - in order to provide the following behaviour: on middle mouse button press a previously - selected text (by mouse drag or left mouse button double click) is appended to the last - paragraph. This behaviour is similar to standard Unix terminal editor behaviour. -*/ -bool QAD_PyEditor::eventFilter( QObject *o, QEvent *e ) -{ - const int t = e->type(); - if ( t == QEvent::MouseButtonPress || t == QEvent::MouseButtonRelease ) { - QMouseEvent * event = (QMouseEvent*)e; - if ( event->button() == MidButton ) { - if ( t == QEvent::MouseButtonPress ) { - QString selection = selectedText(); - QClipboard *cb = QApplication::clipboard(); - if ( !selection.isNull() && !selection.isEmpty() ) - cb->setText( selection ); - const int endPara = paragraphs()-1; - insertAt( cb->text(), endPara, paragraphLength( endPara )-1 ); - return true; // don't allow futher event processing - } - // code from old mouseReleaseEvent() function. - else if ( t == QEvent::MouseButtonRelease ) { - int curPara, curCol; // for cursor position - int endPara, endCol; // for last edited line - getCursorPosition(&curPara, &curCol); - endPara = paragraphs() -1; - return ( curPara != endPara || curCol < SIZEPR ); - } - } - } - return QTextEdit::eventFilter( o, e ); -} - -/*! - Called when a Mouse release event - -void QAD_PyEditor::mouseReleaseEvent ( QMouseEvent * e ) -{ - // MESSAGE("mouseReleaseEvent"); - int curPara, curCol; // for cursor position - int endPara, endCol; // for last edited line - getCursorPosition(&curPara, &curCol); - endPara = paragraphs() -1; - if (e->button() != MidButton) - QTextEdit::mouseReleaseEvent(e); - else if ((curPara == endPara) && (curCol >= SIZEPR)) - QTextEdit::mouseReleaseEvent(e); -} -*/ - -/*! - Called when a drop event (Drag & Drop) -*/ - void QAD_PyEditor::dropEvent (QDropEvent *e) -{ - MESSAGE("dropEvent : not handled"); -} - /*! Checks, is the string a command line or not. */ bool QAD_PyEditor::isCommand( const QString& str) const { - if (str.find(_currentPrompt)==0) - return true; - return false; + // prompt may be '>>> ' or for '... ' + return ( str.find( READY_PROMPT ) == 0 || str.find( DOTS_PROMPT ) == 0 ); } /*! Called when a keyPress event */ -void QAD_PyEditor::keyPressEvent( QKeyEvent *e ) +void QAD_PyEditor::keyPressEvent( QKeyEvent* e ) { - int curLine, curCol; // for cursor position - int endLine, endCol; // for last edited line + // get cursor position + int curLine, curCol; getCursorPosition(&curLine, &curCol); - endLine = paragraphs() -1; - //MESSAGE("current position " << curLine << ", " << curCol); - //MESSAGE("last line " << endLine); - //MESSAGE(e->key()); - int aKey=e->key(); - int keyRange=0; - if ((aKey >= Key_Space) && (aKey <= Key_ydiaeresis)) - keyRange = 0; - else - keyRange = aKey; - - bool ctrlPressed = ( (e->state() & ControlButton) == ControlButton ); - bool shftPressed = ( (e->state() & ShiftButton) == ShiftButton ); - - switch (keyRange) + + // get last edited line + int endLine = paragraphs() -1; + + // get pressed key code + int aKey = e->key(); + + // check if is pressed + bool ctrlPressed = e->state() & ControlButton; + // check if is pressed + bool shftPressed = e->state() & ShiftButton; + // check if is pressed + bool altPressed = e->state() & AltButton; + + // process + key-bindings + if ( aKey == Key_C && ctrlPressed ) { + _buf.truncate(0); + setText("\n"); + _currentPrompt = READY_PROMPT; + setText(_currentPrompt); + return; + } + + // check for printed key + aKey = ( aKey < Key_Space || aKey > Key_ydiaeresis ) ? aKey : 0; + + switch ( aKey ) { + case 0 : + // any printed key { - case 0 : - { - if (curLine key + { + moveCursor( QTextEdit::MoveEnd, false ); + QTextEdit::keyPressEvent( e ); + break; + } + case Key_Up: + // arrow key: process as follows: + // - without , modifiers: previous command in history + // - with modifier key pressed: move cursor one row up without selection + // - with modifier key pressed: move cursor one row up with selection + // - with + modifier keys pressed: scroll one row up + { + if ( ctrlPressed && shftPressed ) { + scrollBy( 0, -QFontMetrics( font() ).lineSpacing() ); } - case Key_Return: - case Key_Enter: - { - if (curLine 0 ) + moveCursor( QTextEdit::MoveUp, true ); } - case Key_Up: - { - // if Cntr+Key_Up event then move cursor up - if (ctrlPressed) { - moveCursor(QTextEdit::MoveUp, false); - } - // if Shift+Key_Up event then move cursor up and select the text - else if ( shftPressed && curLine > 0 ){ - moveCursor(QTextEdit::MoveUp, true); + else if ( ctrlPressed ) { + moveCursor( QTextEdit::MoveUp, false ); + } + else { + QString histLine = _currentPrompt; + if ( ! _isInHistory ) { + _isInHistory = true; + _currentCommand = text( endLine ).remove( 0, PROMPT_SIZE ); + _currentCommand.truncate( _currentCommand.length() - 1 ); } - // scroll the commands stack up - else { - QString histLine = _currentPrompt; - if (! _isInHistory) - { - _isInHistory = true; - _currentCommand = text(endLine).remove(0,SIZEPR); - _currentCommand.truncate( _currentCommand.length() - 1 ); - } - QString previousCommand = myInterp->getPrevious(); - if (previousCommand.compare(BEGIN_HISTORY_PY) != 0) - { - removeParagraph(endLine); - histLine.append(previousCommand); - insertParagraph(histLine, -1); - } - moveCursor(QTextEdit::MoveEnd, false); + QString previousCommand = myInterp->getPrevious(); + if ( previousCommand.compare( BEGIN_HISTORY_PY ) != 0 ) { + removeParagraph( endLine ); + histLine.append( previousCommand ); + insertParagraph( histLine, -1 ); } - break; + moveCursor( QTextEdit::MoveEnd, false ); + } + break; + } + case Key_Down: + // arrow key: process as follows: + // - without , modifiers: next command in history + // - with modifier key pressed: move cursor one row down without selection + // - with modifier key pressed: move cursor one row down with selection + // - with + modifier keys pressed: scroll one row down + { + if ( ctrlPressed && shftPressed ) { + scrollBy( 0, QFontMetrics( font() ).lineSpacing() ); + } + else if ( shftPressed ) { + if ( curLine < endLine ) + moveCursor( QTextEdit::MoveDown, true ); + } + else if ( ctrlPressed ) { + moveCursor( QTextEdit::MoveDown, false ); } - case Key_Down: - { - // if Cntr+Key_Down event then move cursor down - if (ctrlPressed) { - moveCursor(QTextEdit::MoveDown, false); + else { + QString histLine = _currentPrompt; + QString nextCommand = myInterp->getNext(); + if ( nextCommand.compare( TOP_HISTORY_PY ) != 0 ) { + removeParagraph( endLine ); + histLine.append( nextCommand ); + insertParagraph( histLine, -1 ); } - // if Shift+Key_Down event then move cursor down and select the text - else if ( shftPressed && curLine < endLine ) { - moveCursor(QTextEdit::MoveDown, true); + else { + if (_isInHistory) { + _isInHistory = false; + removeParagraph( endLine ); + histLine.append( _currentCommand ); + insertParagraph( histLine, -1 ); + } + } + moveCursor( QTextEdit::MoveEnd, false ); + } + break; + } + case Key_Left: + // arrow key: process as follows: + // - without , modifiers: move one symbol left (taking into account prompt) + // - with modifier key pressed: move one word left (taking into account prompt) + // - with modifier key pressed: move one symbol left with selection + // - with + modifier keys pressed: move one word left with selection + { + if ( !shftPressed && isCommand( text( curLine ) ) && curCol <= PROMPT_SIZE ) { + setCursorPosition( curLine-1, 0 ); + moveCursor( QTextEdit::MoveLineEnd, false ); + } + else { + QTextEdit::keyPressEvent( e ); + } + break; + } + case Key_Right: + // arrow key: process as follows: + // - without , modifiers: move one symbol right (taking into account prompt) + // - with modifier key pressed: move one word right (taking into account prompt) + // - with modifier key pressed: move one symbol right with selection + // - with + modifier keys pressed: move one word right with selection + { + if ( !shftPressed ) { + if ( curCol < paragraphLength( curLine ) ) { + if ( isCommand( text( curLine ) ) && curCol < PROMPT_SIZE ) { + setCursorPosition( curLine, PROMPT_SIZE ); + break; + } } - // scroll the commands stack down else { + if ( curLine < endLine && isCommand( text( curLine+1 ) ) ) { + setCursorPosition( curLine+1, PROMPT_SIZE ); + break; + } + } + } + QTextEdit::keyPressEvent( e ); + break; + } + case Key_PageUp: + // key: process as follows: + // - without , modifiers: first command in history + // - with modifier key pressed: move cursor one page up without selection + // - with modifier key pressed: move cursor one page up with selection + // - with + modifier keys pressed: scroll one page up + { + if ( ctrlPressed && shftPressed ) { + scrollBy( 0, -visibleHeight() ); + } + else if ( shftPressed ) { + if ( curLine > 0 ) + moveCursor( QTextEdit::MovePgUp, true ); + } + else if ( ctrlPressed ) { + moveCursor( QTextEdit::MovePgUp, false ); + } + else { QString histLine = _currentPrompt; - QString nextCommand = myInterp->getNext(); - if (nextCommand.compare(TOP_HISTORY_PY) != 0) - { - removeParagraph(endLine); - histLine.append(nextCommand); - insertParagraph(histLine, -1); - } - else - if (_isInHistory) - { - _isInHistory = false; - removeParagraph(endLine); - histLine.append(_currentCommand); - insertParagraph(histLine, -1); - } - moveCursor(QTextEdit::MoveEnd, false); + if ( ! _isInHistory ) { + _isInHistory = true; + _currentCommand = text( endLine ).remove( 0, PROMPT_SIZE ); + _currentCommand.truncate( _currentCommand.length() - 1 ); + } + QString firstCommand = myInterp->getPrevious(); + QString pcmd; + while ( ( pcmd = QString( myInterp->getPrevious() ) ).compare( BEGIN_HISTORY_PY ) != 0 ) + firstCommand = pcmd; + if ( firstCommand.compare( BEGIN_HISTORY_PY ) != 0 ) { + removeParagraph( endLine ); + histLine.append( firstCommand ); + insertParagraph( histLine, -1 ); } - break; + moveCursor( QTextEdit::MoveEnd, false ); } - case Key_Left: - { - if (!shftPressed && isCommand(text(curLine)) && curCol <= SIZEPR ) - { - setCursorPosition((curLine -1), SIZEPR); - moveCursor(QTextEdit::MoveLineEnd, false); - } - else QTextEdit::keyPressEvent( e ); - break; + break; + } + case Key_PageDown: + // key: process as follows: + // - without , modifiers: last command in history + // - with modifier key pressed: move cursor one page down without selection + // - with modifier key pressed: move cursor one page down with selection + // - with + modifier keys pressed: scroll one page down + { + if ( ctrlPressed && shftPressed ) { + scrollBy( 0, visibleHeight() ); } - case Key_Right: - { - if (!shftPressed && isCommand(text(curLine)) - && curCol < SIZEPR) setCursorPosition(curLine, SIZEPR); - QTextEdit::keyPressEvent( e ); - break; + else if ( shftPressed ) { + if ( curLine < endLine ) + moveCursor( QTextEdit::MovePgDown, true ); + } + else if ( ctrlPressed ) { + moveCursor( QTextEdit::MovePgDown, false ); } - case Key_Home: - { - horizontalScrollBar()->setValue( horizontalScrollBar()->minValue() ); - if (isCommand(text(curLine))) { - setCursorPosition(curLine, SIZEPR); - if ( curCol > SIZEPR && shftPressed ) - setSelection( curLine, SIZEPR, curLine, curCol ); - else - selectAll( false ); + else { + if ( _isInHistory ) { + QString histLine = _currentPrompt; + while ( QString( myInterp->getNext() ).compare( TOP_HISTORY_PY ) != 0 ); + _isInHistory = false; + removeParagraph( endLine ); + histLine.append( _currentCommand ); + insertParagraph( histLine, -1 ); } - else moveCursor(QTextEdit::MoveLineStart, shftPressed); - break; + moveCursor( QTextEdit::MoveEnd, false ); } - case Key_End: - { - moveCursor(QTextEdit::MoveLineEnd, shftPressed); - break; - } - case Key_Backspace : - { - if ((curLine == endLine) && (curCol > SIZEPR)) - QTextEdit::keyPressEvent( e ); - break; + break; + } + case Key_Home: + // key: process as follows: + // - without , modifiers: move cursor to the beginning of the current line without selection + // - with modifier key pressed: move cursor to the very first symbol without selection + // - with modifier key pressed: move cursor to the beginning of the current line with selection + // - with + modifier keys pressed: move cursor to the very first symbol with selection + { + if ( ctrlPressed ) { + moveCursor( QTextEdit::MoveHome, shftPressed ); } - case Key_Delete : - { - if ((curLine == endLine) && (curCol > SIZEPR-1)) + else { + if ( isCommand( text( curLine ) ) ) { + int ps1, ps2, cs1, cs2; + bool hasSelection = hasSelectedText(); + if ( hasSelection ) + getSelection( &ps1, &cs1, &ps2, &cs2 ); + removeSelection(); + horizontalScrollBar()->setValue( horizontalScrollBar()->minValue() ); + if ( curCol > PROMPT_SIZE && shftPressed ) + setSelection( curLine, PROMPT_SIZE, curLine, ( hasSelection && ps1 == ps2 && ps1 == curLine && cs2 > PROMPT_SIZE ) ? cs2 : curCol ); + setCursorPosition( curLine, PROMPT_SIZE ); + } + else { + moveCursor( QTextEdit::MoveLineStart, shftPressed ); + } + } + break; + } + case Key_End: + // key: process as follows: + // - without , modifiers: move cursor to the end of the current line without selection + // - with modifier key pressed: move cursor to the very last symbol without selection + // - with modifier key pressed: move cursor to the end of the current line with selection + // - with + modifier keys pressed: move cursor to the very last symbol with selection + { + if ( ctrlPressed ) { + moveCursor( QTextEdit::MoveEnd, shftPressed ); + } + else { + moveCursor( QTextEdit::MoveLineEnd, shftPressed ); + } + break; + } + case Key_Backspace : + // key: process as follows + // - without any modifiers : delete symbol before the cursor / selection (taking into account prompt) + // - with modifier key pressed: delete previous word + // works only for last (command) line + { + if ( curLine == endLine && ( curCol > PROMPT_SIZE || curCol >= PROMPT_SIZE && hasSelectedText() ) ) { + if ( ctrlPressed && !hasSelectedText() ) { + QString txt = text( curLine ); + int ind = curCol-1; + while ( ind > 0 && txt[ ind ] == ' ' ) ind--; + ind = txt.findRev( ' ', ind ) + 1; + if ( ind > PROMPT_SIZE-1 ) { + setSelection( curLine, ind, curLine, curCol ); + removeSelectedText(); + } + else { + QTextEdit::keyPressEvent( e ); + } + } + else { QTextEdit::keyPressEvent( e ); - break; + } } - case Key_Insert : - { - if ( ctrlPressed ) - copy(); - else if ( shftPressed ) { - moveCursor(QTextEdit::MoveEnd, false); - paste(); + break; + } + case Key_Delete : + // key: process as follows + // - without any modifiers : delete symbol after the cursor / selection (taking into account prompt) + // - with modifier key pressed: delete next word + // works only for last (command) line + { + if ( curLine == endLine && curCol > PROMPT_SIZE-1 ) { + if ( ctrlPressed && !hasSelectedText() ) { + QString txt = text( curLine ); + int ind = curCol; + while ( ind < txt.length()-1 && txt[ ind ] == ' ' ) ind++; + ind = txt.find( ' ', ind ); + while ( ind < txt.length()-1 && txt[ ind ] == ' ' ) ind++; + if ( ind > PROMPT_SIZE-1 ) { + setSelection( curLine, curCol, curLine, ind ); + removeSelectedText(); + } + else { + QTextEdit::keyPressEvent( e ); + } } - else + else { QTextEdit::keyPressEvent( e ); - break; + } } + break; } - if ( e->key() == Key_C && ( e->state() & ControlButton ) ) + case Key_Insert : + // key: process as follows + // - with modifier key pressed: copy() + // - with modifier key pressed: paste() to the command line { - _buf.truncate(0); - setText("\n"); - _currentPrompt = ">>> "; - setText(_currentPrompt); + if ( ctrlPressed ) { + copy(); + } + else if ( shftPressed ) { + if ( curLine != endLine || curCol < PROMPT_SIZE ) + moveCursor( QTextEdit::MoveEnd, false ); + paste(); + } + else + QTextEdit::keyPressEvent( e ); + break; } - + } // NRI : DEBUG PAS TERRIBLE // if (( e->key() == Key_F3) || ( e->key() == Key_F4) || @@ -566,7 +732,7 @@ void QAD_PyEditor::keyPressEvent( QKeyEvent *e ) // NRI // } -void QAD_PyEditor::customEvent(QCustomEvent *e) +void QAD_PyEditor::customEvent(QCustomEvent* e) { switch( e->type() ) { case PYTHON_OK: @@ -575,14 +741,14 @@ void QAD_PyEditor::customEvent(QCustomEvent *e) _buf.truncate(0); setText(myOutput); setText(myError); - _currentPrompt = ">>> "; + _currentPrompt = READY_PROMPT; setText(_currentPrompt); break; } case PYTHON_INCOMPLETE: { _buf.append("\n"); - _currentPrompt = "... "; + _currentPrompt = DOTS_PROMPT; setText(_currentPrompt); break; } diff --git a/src/SALOMEGUI/QAD_PyEditor.h b/src/SALOMEGUI/QAD_PyEditor.h index 5c1972909..941a340df 100644 --- a/src/SALOMEGUI/QAD_PyEditor.h +++ b/src/SALOMEGUI/QAD_PyEditor.h @@ -59,12 +59,11 @@ public: bool isCommand(const QString& str) const; protected: - virtual void keyPressEvent (QKeyEvent * e); - virtual void mousePressEvent (QMouseEvent * e); - //virtual void mouseReleaseEvent (QMouseEvent * e); - virtual void dropEvent (QDropEvent *e); - virtual void customEvent (QCustomEvent *e); - virtual bool eventFilter(QObject *o, QEvent *e); + virtual void contentsDropEvent( QDropEvent* event ); + virtual void contentsMouseReleaseEvent( QMouseEvent* event ); + virtual void keyPressEvent (QKeyEvent* event); + virtual void mousePressEvent (QMouseEvent* event); + virtual void customEvent (QCustomEvent* event); public slots: void handleReturn();