qinputmethod.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qinputmethod.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8QInputMethod::QInputMethod()-
9 : QObject(*new QInputMethodPrivate)-
10{-
11}
never executed: end of block
0
12-
13-
14-
15-
16QInputMethod::~QInputMethod()-
17{-
18}-
19QTransform QInputMethod::inputItemTransform() const-
20{-
21 const QInputMethodPrivate * const d = d_func();-
22 return
never executed: return d->inputItemTransform;
d->inputItemTransform;
never executed: return d->inputItemTransform;
0
23}-
24-
25-
26-
27-
28-
29-
30void QInputMethod::setInputItemTransform(const QTransform &transform)-
31{-
32 QInputMethodPrivate * const d = d_func();-
33 if (d->inputItemTransform == transform
d->inputItemTr...m == transformDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
34 return;
never executed: return;
0
35-
36 d->inputItemTransform = transform;-
37 cursorRectangleChanged();-
38 anchorRectangleChanged();-
39}
never executed: end of block
0
40QRectF QInputMethod::inputItemRectangle() const-
41{-
42 const QInputMethodPrivate * const d = d_func();-
43 return
never executed: return d->inputRectangle;
d->inputRectangle;
never executed: return d->inputRectangle;
0
44}-
45void QInputMethod::setInputItemRectangle(const QRectF &rect)-
46{-
47 QInputMethodPrivate * const d = d_func();-
48 d->inputRectangle = rect;-
49}
never executed: end of block
0
50-
51static QRectF inputMethodQueryRectangle_helper(Qt::InputMethodQuery imquery, const QTransform &xform)-
52{-
53 QRectF r;-
54 if (QObject *focusObject = (static_cast<QGuiApplication *>(QCoreApplication::instance()))->focusObject()
QObject *focus...>focusObject()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
55 QInputMethodQueryEvent query(imquery);-
56 QGuiApplication::sendEvent(focusObject, &query);-
57 r = query.value(imquery).toRectF();-
58 if (r.isValid()
r.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
59 r = xform.mapRect(r);
never executed: r = xform.mapRect(r);
0
60 }
never executed: end of block
0
61 return
never executed: return r;
r;
never executed: return r;
0
62}-
63QRectF QInputMethod::cursorRectangle() const-
64{-
65 const QInputMethodPrivate * const d = d_func();-
66 return
never executed: return inputMethodQueryRectangle_helper(Qt::ImCursorRectangle, d->inputItemTransform);
inputMethodQueryRectangle_helper(Qt::ImCursorRectangle, d->inputItemTransform);
never executed: return inputMethodQueryRectangle_helper(Qt::ImCursorRectangle, d->inputItemTransform);
0
67}-
68QRectF QInputMethod::anchorRectangle() const-
69{-
70 const QInputMethodPrivate * const d = d_func();-
71 return
never executed: return inputMethodQueryRectangle_helper(Qt::ImAnchorRectangle, d->inputItemTransform);
inputMethodQueryRectangle_helper(Qt::ImAnchorRectangle, d->inputItemTransform);
never executed: return inputMethodQueryRectangle_helper(Qt::ImAnchorRectangle, d->inputItemTransform);
0
72}-
73QRectF QInputMethod::keyboardRectangle() const-
74{-
75 const QInputMethodPrivate * const d = d_func();-
76 QPlatformInputContext *ic = d->platformInputContext();-
77 if (ic
icDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
78 return
never executed: return ic->keyboardRect();
ic->keyboardRect();
never executed: return ic->keyboardRect();
0
79 return
never executed: return QRectF();
QRectF();
never executed: return QRectF();
0
80}-
81QRectF QInputMethod::inputItemClipRectangle() const-
82{-
83 const QInputMethodPrivate * const d = d_func();-
84 return
never executed: return inputMethodQueryRectangle_helper(Qt::ImInputItemClipRectangle, d->inputItemTransform);
inputMethodQueryRectangle_helper(Qt::ImInputItemClipRectangle, d->inputItemTransform);
never executed: return inputMethodQueryRectangle_helper(Qt::ImInputItemClipRectangle, d->inputItemTransform);
0
85}-
86void QInputMethod::show()-
87{-
88 QInputMethodPrivate * const d = d_func();-
89 QPlatformInputContext *ic = d->platformInputContext();-
90 if (ic
icDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
91 ic->showInputPanel();
never executed: ic->showInputPanel();
0
92}
never executed: end of block
0
93void QInputMethod::hide()-
94{-
95 QInputMethodPrivate * const d = d_func();-
96 QPlatformInputContext *ic = d->platformInputContext();-
97 if (ic
icDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
98 ic->hideInputPanel();
never executed: ic->hideInputPanel();
0
99}
never executed: end of block
0
100bool QInputMethod::isVisible() const-
101{-
102 const QInputMethodPrivate * const d = d_func();-
103 QPlatformInputContext *ic = d->platformInputContext();-
104 if (ic
icDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
105 return
never executed: return ic->isInputPanelVisible();
ic->isInputPanelVisible();
never executed: return ic->isInputPanelVisible();
0
106 return
never executed: return false;
false;
never executed: return false;
0
107}-
108void QInputMethod::setVisible(bool visible)-
109{-
110 visible ? show() : hide();-
111}
never executed: end of block
0
112bool QInputMethod::isAnimating() const-
113{-
114 const QInputMethodPrivate * const d = d_func();-
115 QPlatformInputContext *ic = d->platformInputContext();-
116 if (ic
icDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
117 return
never executed: return ic->isAnimating();
ic->isAnimating();
never executed: return ic->isAnimating();
0
118 return
never executed: return false;
false;
never executed: return false;
0
119}-
120-
121-
122-
123-
124-
125QLocale QInputMethod::locale() const-
126{-
127 const QInputMethodPrivate * const d = d_func();-
128 QPlatformInputContext *ic = d->platformInputContext();-
129 if (ic
icDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
130 return
never executed: return ic->locale();
ic->locale();
never executed: return ic->locale();
0
131 return
never executed: return QLocale::c();
QLocale::c();
never executed: return QLocale::c();
0
132}-
133-
134-
135-
136-
137-
138Qt::LayoutDirection QInputMethod::inputDirection() const-
139{-
140 const QInputMethodPrivate * const d = d_func();-
141 QPlatformInputContext *ic = d->platformInputContext();-
142 if (ic
icDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
143 return
never executed: return ic->inputDirection();
ic->inputDirection();
never executed: return ic->inputDirection();
0
144 return
never executed: return Qt::LeftToRight;
Qt::LeftToRight;
never executed: return Qt::LeftToRight;
0
145}-
146void QInputMethod::update(Qt::InputMethodQueries queries)-
147{-
148 QInputMethodPrivate * const d = d_func();-
149-
150 if (queries & Qt::ImEnabled
queries & Qt::ImEnabledDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
151 QObject *focus = (static_cast<QGuiApplication *>(QCoreApplication::instance()))->focusObject();-
152 bool enabled = d->objectAcceptsInputMethod(focus);-
153 QPlatformInputContextPrivate::setInputMethodAccepted(enabled);-
154 }
never executed: end of block
0
155-
156 QPlatformInputContext *ic = d->platformInputContext();-
157 if (ic
icDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
158 ic->update(queries);
never executed: ic->update(queries);
0
159-
160 if (queries & Qt::ImCursorRectangle
queries & Qt::...ursorRectangleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
161 cursorRectangleChanged();
never executed: cursorRectangleChanged();
0
162-
163 if (queries & (Qt::ImAnchorRectangle)
queries & (Qt:...chorRectangle)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
164 anchorRectangleChanged();
never executed: anchorRectangleChanged();
0
165-
166 if (queries & (Qt::ImInputItemClipRectangle)
queries & (Qt:...ClipRectangle)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
167 inputItemClipRectangleChanged();
never executed: inputItemClipRectangleChanged();
0
168}
never executed: end of block
0
169-
170-
171-
172-
173-
174-
175-
176void QInputMethod::reset()-
177{-
178 QInputMethodPrivate * const d = d_func();-
179 QPlatformInputContext *ic = d->platformInputContext();-
180 if (ic
icDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
181 ic->reset();
never executed: ic->reset();
0
182}
never executed: end of block
0
183void QInputMethod::commit()-
184{-
185 QInputMethodPrivate * const d = d_func();-
186 QPlatformInputContext *ic = d->platformInputContext();-
187 if (ic
icDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
188 ic->commit();
never executed: ic->commit();
0
189}
never executed: end of block
0
190void QInputMethod::invokeAction(Action a, int cursorPosition)-
191{-
192 QInputMethodPrivate * const d = d_func();-
193 QPlatformInputContext *ic = d->platformInputContext();-
194 if (ic
icDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
195 ic->invokeAction(a, cursorPosition);
never executed: ic->invokeAction(a, cursorPosition);
0
196}
never executed: end of block
0
197-
198bool QInputMethodPrivate::objectAcceptsInputMethod(QObject *object)-
199{-
200 bool enabled = false;-
201 if (object
objectDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
202 QInputMethodQueryEvent query(Qt::ImEnabled);-
203 QGuiApplication::sendEvent(object, &query);-
204 enabled = query.value(Qt::ImEnabled).toBool();-
205 }
never executed: end of block
0
206-
207 return
never executed: return enabled;
enabled;
never executed: return enabled;
0
208}-
209-
210-
211-
212-
213QVariant QInputMethod::queryFocusObject(Qt::InputMethodQuery query, QVariant argument)-
214{-
215 QVariant retval;-
216 QObject *focusObject = (static_cast<QGuiApplication *>(QCoreApplication::instance()))->focusObject();-
217 if (!focusObject
!focusObjectDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
218 return
never executed: return retval;
retval;
never executed: return retval;
0
219-
220 bool newMethodWorks = QMetaObject::invokeMethod(focusObject, "inputMethodQuery",-
221 Qt::DirectConnection,-
222 QReturnArgument<QVariant >("QVariant", retval),-
223 QArgument<Qt::InputMethodQuery >("Qt::InputMethodQuery", query),-
224 QArgument<QVariant >("QVariant", argument));-
225 if (newMethodWorks
newMethodWorksDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
226 return
never executed: return retval;
retval;
never executed: return retval;
0
227-
228 QInputMethodQueryEvent queryEvent(query);-
229 QCoreApplication::sendEvent(focusObject, &queryEvent);-
230 return
never executed: return queryEvent.value(query);
queryEvent.value(query);
never executed: return queryEvent.value(query);
0
231}-
232-
233-
234-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9