diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index 912aec369a..6f7a57ce87 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,10 @@ +2005-05-28 José Matos + + * QContentPane.[Ch]: implement QIM*Events. This brings the dead + keys back into play on systems compiled against a qt-immodule- + patched Qt [bug 1830]. + + 2005-06-20 Michael Schmitt * QPrefsDialog.C: diff --git a/src/frontends/qt2/QContentPane.C b/src/frontends/qt2/QContentPane.C index 3c833e7d56..ceadb7e2c6 100644 --- a/src/frontends/qt2/QContentPane.C +++ b/src/frontends/qt2/QContentPane.C @@ -93,6 +93,10 @@ QContentPane::QContentPane(QWorkArea * parent) setFocusPolicy(QWidget::WheelFocus); setFocus(); setCursor(ibeamCursor); +#if QT_VERSION >= 0x030200 + // to make qt-immodule work + setInputMethodEnabled(true); +#endif // stupid moc strikes again connect(wa_->scrollbar_, SIGNAL(valueChanged(int)), @@ -100,6 +104,37 @@ QContentPane::QContentPane(QWorkArea * parent) } +#if QT_VERSION >= 0x030200 +// to make qt-immodule work +void QContentPane::imStartEvent(QIMEvent *e) +{ + e->accept(); +} + + +void QContentPane::imComposeEvent(QIMEvent *e) +{ + e->accept(); +} + + +void QContentPane::imEndEvent(QIMEvent *e) +{ + QString const text = e->text(); + if (!text.isEmpty()) { + int key = 0; + // needed to make math superscript work on some systems + // ideally, such special coding should not be necessary + if (text == "^") + key = Qt::Key_AsciiCircum; + QKeyEvent ev(QEvent::KeyPress, key, *text.ascii(), 0, text); + keyPressEvent(&ev); + } + e->accept(); +} +#endif + + void QContentPane::generateSyntheticMouseEvent() { // Set things off to generate the _next_ 'pseudo' event. diff --git a/src/frontends/qt2/QContentPane.h b/src/frontends/qt2/QContentPane.h index c7cb8ad89a..16b1564a73 100644 --- a/src/frontends/qt2/QContentPane.h +++ b/src/frontends/qt2/QContentPane.h @@ -101,6 +101,12 @@ protected: void wheelEvent(QWheelEvent * e); /// key press void keyPressEvent(QKeyEvent * e); +#if QT_VERSION >= 0x030200 + /// IM events + void imStartEvent(QIMEvent *); + void imComposeEvent(QIMEvent *); + void imEndEvent(QIMEvent *); +#endif public slots: void doubleClickTimeout();