@@ -3697,6 +3697,12 @@ void QEditor::inputMethodEvent(QInputMethodEvent* e)
3697
3697
}
3698
3698
#endif
3699
3699
}
3700
+ // remove previous text
3701
+ if (e->replacementLength ()>0 ){
3702
+ for (int k=0 ;k<e->replacementLength ();++k){
3703
+ m_cursor.deletePreviousChar ();
3704
+ }
3705
+ }
3700
3706
3701
3707
m_cursor.insertText (e->commitString ());
3702
3708
@@ -6148,6 +6154,7 @@ void QEditor::scrollContentsBy(int dx, int dy)
6148
6154
}
6149
6155
6150
6156
QVariant QEditor::inputMethodQuery (Qt::InputMethodQuery property) const {
6157
+ qDebug ()<<int (property);
6151
6158
switch (property) {
6152
6159
case Qt::ImCursorRectangle:
6153
6160
return cursorMircoFocusRect ();
@@ -6158,7 +6165,7 @@ QVariant QEditor::inputMethodQuery(Qt::InputMethodQuery property) const {
6158
6165
case Qt::ImCursorPosition:
6159
6166
// TODO find out correct value: qtextcontol uses the following
6160
6167
// return QVariant(d->cursor.position() - block.position());
6161
- return QVariant ();
6168
+ return QVariant (cursor (). columnNumber () );
6162
6169
case Qt::ImSurroundingText:
6163
6170
return QVariant (cursor ().line ().text ());
6164
6171
case Qt::ImCurrentSelection:
@@ -6168,7 +6175,9 @@ QVariant QEditor::inputMethodQuery(Qt::InputMethodQuery property) const {
6168
6175
case Qt::ImAnchorPosition:
6169
6176
// TODO find out correct value: qtextcontol uses the following
6170
6177
// return QVariant(qBound(0, d->cursor.anchor() - block.position(), block.length()));
6171
- return QVariant ();
6178
+ return QVariant (cursor ().anchorColumnNumber ());
6179
+ case Qt::ImAbsolutePosition:
6180
+ return QVariant (cursor ().anchorColumnNumber ());
6172
6181
default :
6173
6182
return QVariant ();
6174
6183
}
0 commit comments