Jos�'s qt-immodule fixes (bug 1830)

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9979 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2005-05-28 11:08:50 +00:00
parent 38044d2cf7
commit b6221be763
3 changed files with 48 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2005-05-28 José Matos <jamatos@lyx.org>
* 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 <michael.schmitt@teststep.org> 2005-06-20 Michael Schmitt <michael.schmitt@teststep.org>
* QPrefsDialog.C: * QPrefsDialog.C:

View File

@ -93,6 +93,10 @@ QContentPane::QContentPane(QWorkArea * parent)
setFocusPolicy(QWidget::WheelFocus); setFocusPolicy(QWidget::WheelFocus);
setFocus(); setFocus();
setCursor(ibeamCursor); setCursor(ibeamCursor);
#if QT_VERSION >= 0x030200
// to make qt-immodule work
setInputMethodEnabled(true);
#endif
// stupid moc strikes again // stupid moc strikes again
connect(wa_->scrollbar_, SIGNAL(valueChanged(int)), 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() void QContentPane::generateSyntheticMouseEvent()
{ {
// Set things off to generate the _next_ 'pseudo' event. // Set things off to generate the _next_ 'pseudo' event.

View File

@ -101,6 +101,12 @@ protected:
void wheelEvent(QWheelEvent * e); void wheelEvent(QWheelEvent * e);
/// key press /// key press
void keyPressEvent(QKeyEvent * e); void keyPressEvent(QKeyEvent * e);
#if QT_VERSION >= 0x030200
/// IM events
void imStartEvent(QIMEvent *);
void imComposeEvent(QIMEvent *);
void imEndEvent(QIMEvent *);
#endif
public slots: public slots:
void doubleClickTimeout(); void doubleClickTimeout();