| 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 | } never executed: end of block | 0 | ||||||
| 39 | QRectF QInputMethod::inputItemRectangle() const | - | ||||||
| 40 | { | - | ||||||
| 41 | const QInputMethodPrivate * const d = d_func(); | - | ||||||
| 42 | return never executed: d->inputRectangle;return d->inputRectangle;never executed: return d->inputRectangle; | 0 | ||||||
| 43 | } | - | ||||||
| 44 | void QInputMethod::setInputItemRectangle(const QRectF &rect) | - | ||||||
| 45 | { | - | ||||||
| 46 | QInputMethodPrivate * const d = d_func(); | - | ||||||
| 47 | d->inputRectangle = rect; | - | ||||||
| 48 | } never executed: end of block | 0 | ||||||
| 49 | QRectF QInputMethod::cursorRectangle() const | - | ||||||
| 50 | { | - | ||||||
| 51 | const QInputMethodPrivate * const d = d_func(); | - | ||||||
| 52 | - | |||||||
| 53 | QObject *focusObject = (static_cast<QGuiApplication *>(QCoreApplication::instance()))->focusObject(); | - | ||||||
| 54 | if (!focusObject
| 0 | ||||||
| 55 | return never executed: QRectF();return QRectF();never executed: return QRectF(); | 0 | ||||||
| 56 | - | |||||||
| 57 | QInputMethodQueryEvent query(Qt::ImCursorRectangle); | - | ||||||
| 58 | QGuiApplication::sendEvent(focusObject, &query); | - | ||||||
| 59 | QRectF r = query.value(Qt::ImCursorRectangle).toRectF(); | - | ||||||
| 60 | if (!r.isValid()
| 0 | ||||||
| 61 | return never executed: QRectF();return QRectF();never executed: return QRectF(); | 0 | ||||||
| 62 | - | |||||||
| 63 | return never executed: d->inputItemTransform.mapRect(r);return d->inputItemTransform.mapRect(r);never executed: return d->inputItemTransform.mapRect(r); | 0 | ||||||
| 64 | } | - | ||||||
| 65 | QRectF QInputMethod::keyboardRectangle() const | - | ||||||
| 66 | { | - | ||||||
| 67 | const QInputMethodPrivate * const d = d_func(); | - | ||||||
| 68 | QPlatformInputContext *ic = d->platformInputContext(); | - | ||||||
| 69 | if (ic
| 0 | ||||||
| 70 | return never executed: ic->keyboardRect();return ic->keyboardRect();never executed: return ic->keyboardRect(); | 0 | ||||||
| 71 | return never executed: QRectF();return QRectF();never executed: return QRectF(); | 0 | ||||||
| 72 | } | - | ||||||
| 73 | void QInputMethod::show() | - | ||||||
| 74 | { | - | ||||||
| 75 | QInputMethodPrivate * const d = d_func(); | - | ||||||
| 76 | QPlatformInputContext *ic = d->platformInputContext(); | - | ||||||
| 77 | if (ic
| 0 | ||||||
| 78 | ic->showInputPanel(); never executed: ic->showInputPanel(); | 0 | ||||||
| 79 | } never executed: end of block | 0 | ||||||
| 80 | void QInputMethod::hide() | - | ||||||
| 81 | { | - | ||||||
| 82 | QInputMethodPrivate * const d = d_func(); | - | ||||||
| 83 | QPlatformInputContext *ic = d->platformInputContext(); | - | ||||||
| 84 | if (ic
| 0 | ||||||
| 85 | ic->hideInputPanel(); never executed: ic->hideInputPanel(); | 0 | ||||||
| 86 | } never executed: end of block | 0 | ||||||
| 87 | bool QInputMethod::isVisible() const | - | ||||||
| 88 | { | - | ||||||
| 89 | const QInputMethodPrivate * const d = d_func(); | - | ||||||
| 90 | QPlatformInputContext *ic = d->platformInputContext(); | - | ||||||
| 91 | if (ic
| 0 | ||||||
| 92 | return never executed: ic->isInputPanelVisible();return ic->isInputPanelVisible();never executed: return ic->isInputPanelVisible(); | 0 | ||||||
| 93 | return never executed: false;return false;never executed: return false; | 0 | ||||||
| 94 | } | - | ||||||
| 95 | void QInputMethod::setVisible(bool visible) | - | ||||||
| 96 | { | - | ||||||
| 97 | visible ? show() : hide(); | - | ||||||
| 98 | } never executed: end of block | 0 | ||||||
| 99 | bool QInputMethod::isAnimating() const | - | ||||||
| 100 | { | - | ||||||
| 101 | const QInputMethodPrivate * const d = d_func(); | - | ||||||
| 102 | QPlatformInputContext *ic = d->platformInputContext(); | - | ||||||
| 103 | if (ic
| 0 | ||||||
| 104 | return never executed: ic->isAnimating();return ic->isAnimating();never executed: return ic->isAnimating(); | 0 | ||||||
| 105 | return never executed: false;return false;never executed: return false; | 0 | ||||||
| 106 | } | - | ||||||
| 107 | - | |||||||
| 108 | - | |||||||
| 109 | - | |||||||
| 110 | - | |||||||
| 111 | - | |||||||
| 112 | QLocale QInputMethod::locale() const | - | ||||||
| 113 | { | - | ||||||
| 114 | const QInputMethodPrivate * const d = d_func(); | - | ||||||
| 115 | QPlatformInputContext *ic = d->platformInputContext(); | - | ||||||
| 116 | if (ic
| 0 | ||||||
| 117 | return never executed: ic->locale();return ic->locale();never executed: return ic->locale(); | 0 | ||||||
| 118 | return never executed: QLocale::c();return QLocale::c();never executed: return QLocale::c(); | 0 | ||||||
| 119 | } | - | ||||||
| 120 | - | |||||||
| 121 | - | |||||||
| 122 | - | |||||||
| 123 | - | |||||||
| 124 | - | |||||||
| 125 | Qt::LayoutDirection QInputMethod::inputDirection() const | - | ||||||
| 126 | { | - | ||||||
| 127 | const QInputMethodPrivate * const d = d_func(); | - | ||||||
| 128 | QPlatformInputContext *ic = d->platformInputContext(); | - | ||||||
| 129 | if (ic
| 0 | ||||||
| 130 | return never executed: ic->inputDirection();return ic->inputDirection();never executed: return ic->inputDirection(); | 0 | ||||||
| 131 | return never executed: Qt::LeftToRight;return Qt::LeftToRight;never executed: return Qt::LeftToRight; | 0 | ||||||
| 132 | } | - | ||||||
| 133 | void QInputMethod::update(Qt::InputMethodQueries queries) | - | ||||||
| 134 | { | - | ||||||
| 135 | QInputMethodPrivate * const d = d_func(); | - | ||||||
| 136 | - | |||||||
| 137 | if (queries & Qt::ImEnabled
| 0 | ||||||
| 138 | QObject *focus = (static_cast<QGuiApplication *>(QCoreApplication::instance()))->focusObject(); | - | ||||||
| 139 | bool enabled = d->objectAcceptsInputMethod(focus); | - | ||||||
| 140 | QPlatformInputContextPrivate::setInputMethodAccepted(enabled); | - | ||||||
| 141 | } never executed: end of block | 0 | ||||||
| 142 | - | |||||||
| 143 | QPlatformInputContext *ic = d->platformInputContext(); | - | ||||||
| 144 | if (ic
| 0 | ||||||
| 145 | ic->update(queries); never executed: ic->update(queries); | 0 | ||||||
| 146 | - | |||||||
| 147 | if (queries & Qt::ImCursorRectangle
| 0 | ||||||
| 148 | cursorRectangleChanged(); never executed: cursorRectangleChanged(); | 0 | ||||||
| 149 | } never executed: end of block | 0 | ||||||
| 150 | - | |||||||
| 151 | - | |||||||
| 152 | - | |||||||
| 153 | - | |||||||
| 154 | - | |||||||
| 155 | - | |||||||
| 156 | - | |||||||
| 157 | void QInputMethod::reset() | - | ||||||
| 158 | { | - | ||||||
| 159 | QInputMethodPrivate * const d = d_func(); | - | ||||||
| 160 | QPlatformInputContext *ic = d->platformInputContext(); | - | ||||||
| 161 | if (ic
| 0 | ||||||
| 162 | ic->reset(); never executed: ic->reset(); | 0 | ||||||
| 163 | } never executed: end of block | 0 | ||||||
| 164 | void QInputMethod::commit() | - | ||||||
| 165 | { | - | ||||||
| 166 | QInputMethodPrivate * const d = d_func(); | - | ||||||
| 167 | QPlatformInputContext *ic = d->platformInputContext(); | - | ||||||
| 168 | if (ic
| 0 | ||||||
| 169 | ic->commit(); never executed: ic->commit(); | 0 | ||||||
| 170 | } never executed: end of block | 0 | ||||||
| 171 | void QInputMethod::invokeAction(Action a, int cursorPosition) | - | ||||||
| 172 | { | - | ||||||
| 173 | QInputMethodPrivate * const d = d_func(); | - | ||||||
| 174 | QPlatformInputContext *ic = d->platformInputContext(); | - | ||||||
| 175 | if (ic
| 0 | ||||||
| 176 | ic->invokeAction(a, cursorPosition); never executed: ic->invokeAction(a, cursorPosition); | 0 | ||||||
| 177 | } never executed: end of block | 0 | ||||||
| 178 | - | |||||||
| 179 | bool QInputMethodPrivate::objectAcceptsInputMethod(QObject *object) | - | ||||||
| 180 | { | - | ||||||
| 181 | bool enabled = false; | - | ||||||
| 182 | if (object
| 0 | ||||||
| 183 | QInputMethodQueryEvent query(Qt::ImEnabled); | - | ||||||
| 184 | QGuiApplication::sendEvent(object, &query); | - | ||||||
| 185 | enabled = query.value(Qt::ImEnabled).toBool(); | - | ||||||
| 186 | } never executed: end of block | 0 | ||||||
| 187 | - | |||||||
| 188 | return never executed: enabled;return enabled;never executed: return enabled; | 0 | ||||||
| 189 | } | - | ||||||
| 190 | - | |||||||
| 191 | - | |||||||
| 192 | - | |||||||
| 193 | - | |||||||
| 194 | QVariant QInputMethod::queryFocusObject(Qt::InputMethodQuery query, QVariant argument) | - | ||||||
| 195 | { | - | ||||||
| 196 | QVariant retval; | - | ||||||
| 197 | QObject *focusObject = (static_cast<QGuiApplication *>(QCoreApplication::instance()))->focusObject(); | - | ||||||
| 198 | if (!focusObject
| 0 | ||||||
| 199 | return never executed: retval;return retval;never executed: return retval; | 0 | ||||||
| 200 | - | |||||||
| 201 | bool newMethodWorks = QMetaObject::invokeMethod(focusObject, "inputMethodQuery", | - | ||||||
| 202 | Qt::DirectConnection, | - | ||||||
| 203 | QReturnArgument<QVariant >("QVariant", retval), | - | ||||||
| 204 | QArgument<Qt::InputMethodQuery >("Qt::InputMethodQuery", query), | - | ||||||
| 205 | QArgument<QVariant >("QVariant", argument)); | - | ||||||
| 206 | if (newMethodWorks
| 0 | ||||||
| 207 | return never executed: retval;return retval;never executed: return retval; | 0 | ||||||
| 208 | - | |||||||
| 209 | QInputMethodQueryEvent queryEvent(query); | - | ||||||
| 210 | QCoreApplication::sendEvent(focusObject, &queryEvent); | - | ||||||
| 211 | return never executed: queryEvent.value(query);return queryEvent.value(query);never executed: return queryEvent.value(query); | 0 | ||||||
| 212 | } | - | ||||||
| 213 | - | |||||||
| 214 | - | |||||||
| 215 | - | |||||||
| Switch to Source code | Preprocessed file |