MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / commitStateChange

Method commitStateChange

src/tools/text_object_editor_helper.cpp:207–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205
206
207void TextObjectEditorHelper::commitStateChange()
208{
209 Q_ASSERT(anchor_position == qBound(0, anchor_position, pristine_text.length()));
210 Q_ASSERT(cursor_position == qBound(0, cursor_position, pristine_text.length()));
211 Q_ASSERT(line_selection_position == qBound(0, line_selection_position, pristine_text.length()));
212 Q_ASSERT(preedit_cursor == qBound(0, preedit_cursor, preedit_string.length()));
213
214#ifdef DEBUG_INPUT_METHOD_SUPPORT
215 {
216 auto surrounding_text = pristine_text.mid(blockStart(), blockEnd() - blockStart());
217 qDebug("\n*** @%d:\"%s[%s|%s]%s\"\n a..c: @+%d..%d, p: c+%d\n action: %d", blockStart(),
218 qPrintable(pristine_text.mid(blockStart(), cursor_position - blockStart())),
219 qPrintable(preedit_string.left(preedit_cursor)),
220 qPrintable(preedit_string.mid(preedit_cursor)),
221 qPrintable(pristine_text.mid(cursor_position, blockEnd() - blockStart())),
222 anchor_position - blockStart(), cursor_position - blockStart(), preedit_cursor,
223 state_change_action & 0x03);
224 }
225#endif
226
227 dirty = false;
228 updateDisplayText();
229 if (QGuiApplication::inputMethod()->isVisible())
230 {
231 auto im_query = Qt::ImQueryAll;
232 switch (state_change_action & 0x03)
233 {
234 case ResetInputMethod:
235#ifdef DEBUG_INPUT_METHOD_SUPPORT
236 qDebug("\n>>> inputMethod()->reset()");
237#endif
238 QGuiApplication::inputMethod()->reset();
239 break;
240 case UpdateInputProperties:
241 im_query = Qt::ImQueryInput;
242 Q_FALLTHROUGH();
243 case UpdateAllProperties:
244#ifdef DEBUG_INPUT_METHOD_SUPPORT
245 qDebug("\n>>> inputMethod()->update(%d)", im_query);
246#endif
247 QGuiApplication::inputMethod()->update(im_query);
248#ifdef Q_OS_ANDROID
249 // QTBUG-58013
250 Q_UNUSED(im_query)
251# ifdef DEBUG_INPUT_METHOD_SUPPORT
252 qDebug("\n>>> cursorPositionChanged");
253# endif
254 editor->getMainWidget()->cursorPositionChanged();
255#endif
256 break;
257 case NoInputMethodAction:
258 ;
259 }
260 }
261 emit stateChanged();
262}
263
264

Callers 1

~BatchEditMethod · 0.80

Calls 5

getMainWidgetMethod · 0.80
lengthMethod · 0.45
isVisibleMethod · 0.45
resetMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected