diff --git a/qt4/immodule/candidatewindow.cpp b/qt4/immodule/candidatewindow.cpp index 0ed8996..6c4f20f 100644 --- a/qt4/immodule/candidatewindow.cpp +++ b/qt4/immodule/candidatewindow.cpp @@ -64,7 +64,7 @@ CandidateWindow::CandidateWindow( QWidget *parent ) : QFrame( parent, candidateFlag ), nrCandidates( 0 ), displayLimit( 0 ), candidateIndex( -1 ), pageIndex( -1 ), ic( 0 ), isAlwaysLeft( false ), subWin( 0 ), hasAnnotation( uim_scm_symbol_value_bool( - "eb-enable-for-annotation?" ) == UIM_TRUE ) + "eb-enable-for-annotation?" ) == UIM_TRUE ), window( 0 ) { setFrameStyle( Raised | NoFrame ); @@ -113,6 +113,8 @@ CandidateWindow::~CandidateWindow() void CandidateWindow::popup() { + window = QApplication::focusWidget()->window(); + window->installEventFilter( this ); raise(); show(); } @@ -509,6 +511,18 @@ QSize CandidateWindow::sizeHint() const return QSize( width, height ); } +bool CandidateWindow::eventFilter( QObject *obj, QEvent *event ) +{ + if ( obj == window) { + if ( event->type() == QEvent::Move ) { + QMoveEvent *moveEvent = static_cast( event ); + move( pos() + moveEvent->pos() - moveEvent->oldPos() ); + } + return false; + } + return QFrame::eventFilter( obj, event ); +} + QSize CandidateListView::sizeHint() const { // frame width diff --git a/qt4/immodule/candidatewindow.h b/qt4/immodule/candidatewindow.h index 54b5f19..167cfd5 100644 --- a/qt4/immodule/candidatewindow.h +++ b/qt4/immodule/candidatewindow.h @@ -89,6 +89,8 @@ protected: virtual void moveEvent( QMoveEvent * ); virtual void resizeEvent( QResizeEvent * ); + bool eventFilter( QObject *obj, QEvent *event ); + QUimInputContext *ic; CandidateListView *cList; @@ -102,6 +104,8 @@ protected: SubWindow *subWin; const bool hasAnnotation; + + QWidget *window; };