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