Kaydet (Commit) 1b2aaed5 authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski Kaydeden (comit) Katarina Behrens

tdf#123956 Qt5 IM update cursor position

This sets the cursor position to the one provided by the
QInputMethodEvent::Cursor attribute.

Change-Id: I4a99f9939b53c69631e45d41102bf9c7f53f0ff5
Reviewed-on: https://gerrit.libreoffice.org/71782
Tested-by: Jenkins
Reviewed-by: 's avatarJan-Marek Glogowski <glogow@fbihome.de>
(cherry picked from commit 110fd705)
Reviewed-on: https://gerrit.libreoffice.org/71955Reviewed-by: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
üst 2376db06
...@@ -469,10 +469,32 @@ void Qt5Widget::inputMethodEvent(QInputMethodEvent* pEvent) ...@@ -469,10 +469,32 @@ void Qt5Widget::inputMethodEvent(QInputMethodEvent* pEvent)
{ {
aInputEvent.maText = toOUString(pEvent->preeditString()); aInputEvent.maText = toOUString(pEvent->preeditString());
aInputEvent.mnCursorPos = 0; 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); 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) if (nLength)
aInputEvent.mpTextAttr = &aTextAttrs[0]; aInputEvent.mpTextAttr = &aTextAttrs[0];
m_pFrame->CallCallback(SalEvent::ExtTextInput, &aInputEvent); m_pFrame->CallCallback(SalEvent::ExtTextInput, &aInputEvent);
pEvent->accept(); pEvent->accept();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment