diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qt5/Qt5Widget.cxx | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/vcl/qt5/Qt5Widget.cxx b/vcl/qt5/Qt5Widget.cxx index 62fae3736247..3bc310954cc8 100644 --- a/vcl/qt5/Qt5Widget.cxx +++ b/vcl/qt5/Qt5Widget.cxx @@ -469,10 +469,32 @@ void Qt5Widget::inputMethodEvent(QInputMethodEvent* pEvent) { aInputEvent.maText = toOUString(pEvent->preeditString()); aInputEvent.mnCursorPos = 0; - sal_Int32 nLength = aInputEvent.maText.getLength(); + + const sal_Int32 nLength = aInputEvent.maText.getLength(); + const QList<QInputMethodEvent::Attribute>& rAttrList = pEvent->attributes(); std::vector<ExtTextInputAttr> aTextAttrs(nLength, ExtTextInputAttr::Underline); + + for (int i = 0; i < rAttrList.size(); ++i) + { + const QInputMethodEvent::Attribute& rAttr = rAttrList.at(i); + switch (rAttr.type) + { + case QInputMethodEvent::Cursor: + { + aInputEvent.mnCursorPos = rAttr.start; + if (rAttr.length == 0) + aInputEvent.mnCursorFlags |= EXTTEXTINPUT_CURSOR_INVISIBLE; + break; + } + default: + SAL_WARN("vcl.qt5", "Unhandled QInputMethodEvent attribute: " + << static_cast<int>(rAttr.type)); + break; + } + } if (nLength) aInputEvent.mpTextAttr = &aTextAttrs[0]; + m_pFrame->CallCallback(SalEvent::ExtTextInput, &aInputEvent); pEvent->accept(); } |