From b6221be76387c51a755ddb033f972652cd761b47 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Sat, 28 May 2005 11:08:50 +0000 Subject: [PATCH] =?utf8?q?Jos=EF=BF=BD's=20qt-immodule=20fixes=20(bug=2018?= =?utf8?q?30)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9979 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt2/ChangeLog | 7 +++++++ src/frontends/qt2/QContentPane.C | 35 ++++++++++++++++++++++++++++++++ src/frontends/qt2/QContentPane.h | 6 ++++++ 3 files changed, 48 insertions(+) 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(); -- 2.39.5