QIBusInputContextProxy *context;
bool valid;
+ QString predit;
};
void QIBusPlatformInputContext::invokeAction(QInputPanel::Action a, int x)
{
- QPlatformInputContext::invokeAction(a, x);
-
if (!d->valid)
return;
+
+ if (a == QInputPanel::Click)
+ commit();
}
void QIBusPlatformInputContext::reset()
return;
d->context->Reset();
+ d->predit = QString();
+}
+
+void QIBusPlatformInputContext::commit()
+{
+ QPlatformInputContext::commit();
+
+ if (!d->valid)
+ return;
+
+ QObject *input = qApp->inputPanel()->inputItem();
+ if (!input) {
+ d->predit = QString();
+ return;
+ }
+
+ QInputMethodEvent event;
+ event.setCommitString(d->predit);
+ QCoreApplication::sendEvent(input, &event);
+
+ d->context->Reset();
+ d->predit = QString();
}
+
void QIBusPlatformInputContext::update(Qt::InputMethodQueries q)
{
QPlatformInputContext::update(q);
QInputMethodEvent event;
event.setCommitString(t.text);
QCoreApplication::sendEvent(input, &event);
+
+ d->predit = QString();
}
void QIBusPlatformInputContext::updatePreeditText(const QDBusVariant &text, uint cursorPos, bool visible)
qDebug() << "preedit text:" << t.text;
QList<QInputMethodEvent::Attribute> attributes = t.attributes.imAttributes();
- attributes += QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursorPos, visible ? 1 : 0, QVariant());
+ if (!t.text.isEmpty())
+ attributes += QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, cursorPos, visible ? 1 : 0, QVariant());
QInputMethodEvent event(t.text, attributes);
QCoreApplication::sendEvent(input, &event);
+
+ d->predit = t.text;
}