From adaa3fc546ed831ec69a019c1e0ef48d9e69eb12 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 4 Mar 2015 11:27:27 +0100 Subject: Fix invocations of static methods of QGuiApplication/QCoreApplication. Change-Id: I7bcc209b0c6e77cf6d974af85a19487345a48975 Reviewed-by: Erik Verbruggen --- src/imports/testlib/main.cpp | 2 +- .../qmltooling/qmldbg_qtquick2/inspecttool.cpp | 6 +++--- src/qml/parser/qqmljs.g | 10 +++++----- src/qml/parser/qqmljsparser.cpp | 12 ++++++------ src/quick/items/qquickdrag.cpp | 4 ++-- src/quick/items/qquickitem.cpp | 2 +- src/quick/items/qquickitemsmodule.cpp | 2 +- src/quick/items/qquickmousearea.cpp | 2 +- src/quick/items/qquickmultipointtoucharea.cpp | 2 +- src/quick/items/qquickmultipointtoucharea_p.h | 2 +- src/quick/items/qquickpathview.cpp | 5 +++-- src/quick/items/qquickpincharea.cpp | 2 +- src/quick/items/qquicktext.cpp | 2 +- src/quick/items/qquicktextcontrol.cpp | 14 +++++++------- src/quick/items/qquicktextedit.cpp | 4 ++-- src/quick/items/qquicktextinput.cpp | 20 ++++++++++---------- src/quick/items/qquicktextinput_p_p.h | 8 ++++---- src/quick/items/qquickwindow.cpp | 18 +++++++++--------- 18 files changed, 59 insertions(+), 58 deletions(-) (limited to 'src') diff --git a/src/imports/testlib/main.cpp b/src/imports/testlib/main.cpp index 977a83af71..c42ece5da5 100644 --- a/src/imports/testlib/main.cpp +++ b/src/imports/testlib/main.cpp @@ -66,7 +66,7 @@ public: { return QTest::printAvailableFunctions; } - int dragThreshold() const { return qApp->styleHints()->startDragDistance(); } + int dragThreshold() const { return QGuiApplication::styleHints()->startDragDistance(); } Q_SIGNALS: void printAvailableFunctionsChanged(); diff --git a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp index 0a9981eccb..f86225fa0a 100644 --- a/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp +++ b/src/plugins/qmltooling/qmldbg_qtquick2/inspecttool.cpp @@ -75,7 +75,7 @@ InspectTool::InspectTool(QQuickViewInspector *inspector, QQuickView *view) : connect(&m_pressAndHoldTimer, SIGNAL(timeout()), SLOT(zoomTo100())); //Timer to display selected item's name m_nameDisplayTimer.setSingleShot(true); - m_nameDisplayTimer.setInterval(qApp->styleHints()->mouseDoubleClickInterval()); + m_nameDisplayTimer.setInterval(QGuiApplication::styleHints()->mouseDoubleClickInterval()); connect(&m_nameDisplayTimer, SIGNAL(timeout()), SLOT(showSelectedItemName())); enable(true); } @@ -256,7 +256,7 @@ void InspectTool::touchEvent(QTouchEvent *event) !m_didPressAndHold && m_tapEvent) { m_tapEvent = false; bool doubleTap = event->timestamp() - m_touchTimestamp - < static_cast(qApp->styleHints()->mouseDoubleClickInterval()); + < static_cast(QGuiApplication::styleHints()->mouseDoubleClickInterval()); if (doubleTap) { m_nameDisplayTimer.stop(); selectNextItem(); @@ -368,7 +368,7 @@ void InspectTool::moveItem(bool valid) if (!m_dragStarted && valid && ((m_dragStartPosition - m_mousePosition).manhattanLength() - > qApp->styleHints()->startDragDistance())) { + > QGuiApplication::styleHints()->startDragDistance())) { m_pressAndHoldTimer.stop(); m_dragStarted = true; } diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g index ae430e942d..71b6978983 100644 --- a/src/qml/parser/qqmljs.g +++ b/src/qml/parser/qqmljs.g @@ -3055,9 +3055,9 @@ PropertyAssignmentListOpt: PropertyAssignmentList ; QString msg; int token = token_buffer[0].token; if (token < 0 || token >= TERMINAL_COUNT) - msg = qApp->translate("QQmlParser", "Syntax error"); + msg = QCoreApplication::translate("QQmlParser", "Syntax error"); else - msg = qApp->translate("QQmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token])); + msg = QCoreApplication::translate("QQmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token])); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); action = errorState; @@ -3085,7 +3085,7 @@ PropertyAssignmentListOpt: PropertyAssignmentList ; for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) { int a = t_action(errorState, *tk); if (a > 0 && t_action(a, yytoken)) { - const QString msg = qApp->translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk])); + const QString msg = QCoreApplication::translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk])); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); yytoken = *tk; @@ -3109,7 +3109,7 @@ PropertyAssignmentListOpt: PropertyAssignmentList ; int a = t_action(errorState, tk); if (a > 0 && t_action(a, yytoken)) { - const QString msg = qApp->translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk])); + const QString msg = QCoreApplication::translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk])); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); yytoken = tk; @@ -3122,7 +3122,7 @@ PropertyAssignmentListOpt: PropertyAssignmentList ; } } - const QString msg = qApp->translate("QQmlParser", "Syntax error"); + const QString msg = QCoreApplication::translate("QQmlParser", "Syntax error"); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); } diff --git a/src/qml/parser/qqmljsparser.cpp b/src/qml/parser/qqmljsparser.cpp index 520c377034..c1162f875c 100644 --- a/src/qml/parser/qqmljsparser.cpp +++ b/src/qml/parser/qqmljsparser.cpp @@ -1807,7 +1807,7 @@ case 355: { yylloc.startColumn += yylloc.length; yylloc.length = 0; - //const QString msg = qApp->translate("QQmlParser", "Missing `;'"); + //const QString msg = QCoreApplication::translate("QQmlParser", "Missing `;'"); //diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Warning, yylloc, msg)); first_token = &token_buffer[0]; @@ -1837,9 +1837,9 @@ case 355: { QString msg; int token = token_buffer[0].token; if (token < 0 || token >= TERMINAL_COUNT) - msg = qApp->translate("QQmlParser", "Syntax error"); + msg = QCoreApplication::translate("QQmlParser", "Syntax error"); else - msg = qApp->translate("QQmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token])); + msg = QCoreApplication::translate("QQmlParser", "Unexpected token `%1'").arg(QLatin1String(spell[token])); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); action = errorState; @@ -1867,7 +1867,7 @@ case 355: { for (int *tk = tokens; *tk != EOF_SYMBOL; ++tk) { int a = t_action(errorState, *tk); if (a > 0 && t_action(a, yytoken)) { - const QString msg = qApp->translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk])); + const QString msg = QCoreApplication::translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[*tk])); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); yytoken = *tk; @@ -1891,7 +1891,7 @@ case 355: { int a = t_action(errorState, tk); if (a > 0 && t_action(a, yytoken)) { - const QString msg = qApp->translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk])); + const QString msg = QCoreApplication::translate("QQmlParser", "Expected token `%1'").arg(QLatin1String(spell[tk])); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); yytoken = tk; @@ -1904,7 +1904,7 @@ case 355: { } } - const QString msg = qApp->translate("QQmlParser", "Syntax error"); + const QString msg = QCoreApplication::translate("QQmlParser", "Syntax error"); diagnostic_messages.append(DiagnosticMessage(DiagnosticMessage::Error, token_buffer[0].loc, msg)); } diff --git a/src/quick/items/qquickdrag.cpp b/src/quick/items/qquickdrag.cpp index 7ce649c7eb..64e46d1762 100644 --- a/src/quick/items/qquickdrag.cpp +++ b/src/quick/items/qquickdrag.cpp @@ -784,7 +784,7 @@ void QQuickDragAttached::startDrag(QQmlV4Function *args) QQuickDrag::QQuickDrag(QObject *parent) : QObject(parent), _target(0), _axis(XAndYAxis), _xmin(-FLT_MAX), _xmax(FLT_MAX), _ymin(-FLT_MAX), _ymax(FLT_MAX), _active(false), _filterChildren(false), - _smoothed(true), _threshold(qApp->styleHints()->startDragDistance()) + _smoothed(true), _threshold(QGuiApplication::styleHints()->startDragDistance()) { } @@ -906,7 +906,7 @@ void QQuickDrag::setThreshold(qreal value) void QQuickDrag::resetThreshold() { - setThreshold(qApp->styleHints()->startDragDistance()); + setThreshold(QGuiApplication::styleHints()->startDragDistance()); } bool QQuickDrag::active() const diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 4157fc4a66..68ea5f4dbf 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -4752,7 +4752,7 @@ void QQuickItem::itemChange(ItemChange change, const ItemChangeData &value) void QQuickItem::updateInputMethod(Qt::InputMethodQueries queries) { if (hasActiveFocus()) - qApp->inputMethod()->update(queries); + QGuiApplication::inputMethod()->update(queries); } #endif // QT_NO_IM diff --git a/src/quick/items/qquickitemsmodule.cpp b/src/quick/items/qquickitemsmodule.cpp index b1116bdb64..6c342cc491 100644 --- a/src/quick/items/qquickitemsmodule.cpp +++ b/src/quick/items/qquickitemsmodule.cpp @@ -126,7 +126,7 @@ static void qt_quickitems_defineModule(const char *uri, int major, int minor) QQuickItemPrivate::registerAccessorProperties(); #ifdef QT_NO_MOVIE - qmlRegisterTypeNotAvailable(uri,major,minor,"AnimatedImage", qApp->translate("QQuickAnimatedImage","Qt was built without support for QMovie")); + qmlRegisterTypeNotAvailable(uri,major,minor,"AnimatedImage", QCoreApplication::translate("QQuickAnimatedImage","Qt was built without support for QMovie")); #else qmlRegisterType(uri,major,minor,"AnimatedImage"); #endif diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp index 6227329fbc..9b1d54173a 100644 --- a/src/quick/items/qquickmousearea.cpp +++ b/src/quick/items/qquickmousearea.cpp @@ -676,7 +676,7 @@ void QQuickMouseArea::mousePressEvent(QMouseEvent *event) #endif setHovered(true); d->startScene = event->windowPos(); - d->pressAndHoldTimer.start(qApp->styleHints()->mousePressAndHoldInterval(), this); + d->pressAndHoldTimer.start(QGuiApplication::styleHints()->mousePressAndHoldInterval(), this); setKeepMouseGrab(d->stealMouse); event->setAccepted(setPressed(event->button(), true)); } diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp index dcc07300e4..e6b63d32f2 100644 --- a/src/quick/items/qquickmultipointtoucharea.cpp +++ b/src/quick/items/qquickmultipointtoucharea.cpp @@ -555,7 +555,7 @@ void QQuickMultiPointTouchArea::updateTouchData(QEvent *event) //see if we should be grabbing the gesture if (!_stealMouse /* !ignoring gesture*/) { bool offerGrab = false; - const int dragThreshold = qApp->styleHints()->startDragDistance(); + const int dragThreshold = QGuiApplication::styleHints()->startDragDistance(); foreach (const QTouchEvent::TouchPoint &p, touchPoints) { if (p.state() == Qt::TouchPointReleased) continue; diff --git a/src/quick/items/qquickmultipointtoucharea_p.h b/src/quick/items/qquickmultipointtoucharea_p.h index d2e677729a..e5c547da81 100644 --- a/src/quick/items/qquickmultipointtoucharea_p.h +++ b/src/quick/items/qquickmultipointtoucharea_p.h @@ -160,7 +160,7 @@ class QQuickGrabGestureEvent : public QObject Q_PROPERTY(QQmlListProperty touchPoints READ touchPoints) Q_PROPERTY(qreal dragThreshold READ dragThreshold) public: - QQuickGrabGestureEvent() : _grab(false), _dragThreshold(qApp->styleHints()->startDragDistance()) {} + QQuickGrabGestureEvent() : _grab(false), _dragThreshold(QGuiApplication::styleHints()->startDragDistance()) {} Q_INVOKABLE void grab() { _grab = true; } bool wantsGrab() const { return _grab; } diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index 66b0e5c292..352a939e1b 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -1636,8 +1636,9 @@ void QQuickPathViewPrivate::handleMouseMoveEvent(QMouseEvent *event) // then we'll assume that this gesture targets the PathView. This ensures PathView gesture grabbing // is in sync with other items. QPointF pathDelta = pathPoint - startPoint; - if (qAbs(pathDelta.x()) > qApp->styleHints()->startDragDistance() * 0.8 - || qAbs(pathDelta.y()) > qApp->styleHints()->startDragDistance() * 0.8) { + const int startDragDistance = QGuiApplication::styleHints()->startDragDistance(); + if (qAbs(pathDelta.x()) > startDragDistance * 0.8 + || qAbs(pathDelta.y()) > startDragDistance * 0.8) { stealMouse = true; q->setKeepMouseGrab(true); } diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp index 8a391b7aea..07bf268309 100644 --- a/src/quick/items/qquickpincharea.cpp +++ b/src/quick/items/qquickpincharea.cpp @@ -494,7 +494,7 @@ void QQuickPinchArea::updatePinch() } } if (d->pinchActivated && !d->pinchRejected) { - const int dragThreshold = qApp->styleHints()->startDragDistance(); + const int dragThreshold = QGuiApplication::styleHints()->startDragDistance(); QPointF p1 = touchPoint1.scenePos(); QPointF p2 = touchPoint2.scenePos(); qreal dx = p1.x() - p2.x(); diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 1919ba9e79..339a757196 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -1753,7 +1753,7 @@ bool QQuickTextPrivate::determineHorizontalAlignment() { if (hAlignImplicit) { #ifndef QT_NO_IM - bool alignToRight = text.isEmpty() ? qApp->inputMethod()->inputDirection() == Qt::RightToLeft : rightToLeftText; + bool alignToRight = text.isEmpty() ? QGuiApplication::inputMethod()->inputDirection() == Qt::RightToLeft : rightToLeftText; #else bool alignToRight = rightToLeftText; #endif diff --git a/src/quick/items/qquicktextcontrol.cpp b/src/quick/items/qquicktextcontrol.cpp index 3dc11843e3..95d2e7c995 100644 --- a/src/quick/items/qquicktextcontrol.cpp +++ b/src/quick/items/qquicktextcontrol.cpp @@ -448,8 +448,8 @@ void QQuickTextControlPrivate::setBlinkingCursorEnabled(bool enable) { Q_Q(QQuickTextControl); - if (enable && qApp->styleHints()->cursorFlashTime() > 0) - cursorBlinkTimer.start(qApp->styleHints()->cursorFlashTime() / 2, q); + if (enable && QGuiApplication::styleHints()->cursorFlashTime() > 0) + cursorBlinkTimer.start(QGuiApplication::styleHints()->cursorFlashTime() / 2, q); else cursorBlinkTimer.stop(); @@ -1031,7 +1031,7 @@ void QQuickTextControlPrivate::mousePressEvent(QMouseEvent *e, const QPointF &po #endif if (tripleClickTimer.isActive() - && ((pos - tripleClickPoint).toPoint().manhattanLength() < qApp->styleHints()->startDragDistance())) { + && ((pos - tripleClickPoint).toPoint().manhattanLength() < QGuiApplication::styleHints()->startDragDistance())) { cursor.movePosition(QTextCursor::StartOfBlock); cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor); @@ -1231,7 +1231,7 @@ void QQuickTextControlPrivate::mouseDoubleClickEvent(QMouseEvent *e, const QPoin selectedWordOnDoubleClick = cursor; tripleClickPoint = pos; - tripleClickTimer.start(qApp->styleHints()->mouseDoubleClickInterval(), q); + tripleClickTimer.start(QGuiApplication::styleHints()->mouseDoubleClickInterval(), q); if (doEmit) { selectionChanged(); #ifndef QT_NO_CLIPBOARD @@ -1258,7 +1258,7 @@ bool QQuickTextControlPrivate::sendMouseEventToInputContext(QMouseEvent *e, cons if (cursorPos >= 0 && cursorPos <= layout->preeditAreaText().length()) { if (e->type() == QEvent::MouseButtonRelease) { - qApp->inputMethod()->invokeAction(QInputMethod::Click, cursorPos); + QGuiApplication::inputMethod()->invokeAction(QInputMethod::Click, cursorPos); } return true; @@ -1676,7 +1676,7 @@ void QQuickTextControlPrivate::commitPreedit() if (!hasImState) return; - qApp->inputMethod()->commit(); + QGuiApplication::inputMethod()->commit(); if (!hasImState) return; @@ -1692,7 +1692,7 @@ void QQuickTextControlPrivate::cancelPreedit() if (!hasImState) return; - qApp->inputMethod()->reset(); + QGuiApplication::inputMethod()->reset(); QInputMethodEvent event; QCoreApplication::sendEvent(q->parent(), &event); diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index 20416da69a..ba3220ba9b 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -2401,10 +2401,10 @@ void QQuickTextEditPrivate::handleFocusEvent(QFocusEvent *event) #ifndef QT_NO_IM if (focusOnPress && !q->isReadOnly()) qGuiApp->inputMethod()->show(); - q->connect(qApp->inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)), + q->connect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)), q, SLOT(q_updateAlignment())); } else { - q->disconnect(qApp->inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)), + q->disconnect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)), q, SLOT(q_updateAlignment())); #endif } diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp index 1d86b4b000..1b7552201f 100644 --- a/src/quick/items/qquicktextinput.cpp +++ b/src/quick/items/qquicktextinput.cpp @@ -543,7 +543,7 @@ Qt::LayoutDirection QQuickTextInputPrivate::layoutDirection() const direction = textDirection(); #ifndef QT_NO_IM if (direction == Qt::LayoutDirectionAuto) - direction = qApp->inputMethod()->inputDirection(); + direction = QGuiApplication::inputMethod()->inputDirection(); #endif } return (direction == Qt::LayoutDirectionAuto) ? Qt::LeftToRight : direction; @@ -556,7 +556,7 @@ bool QQuickTextInputPrivate::determineHorizontalAlignment() Qt::LayoutDirection direction = textDirection(); #ifndef QT_NO_IM if (direction == Qt::LayoutDirectionAuto) - direction = qApp->inputMethod()->inputDirection(); + direction = QGuiApplication::inputMethod()->inputDirection(); #endif return setHAlign(direction == Qt::RightToLeft ? QQuickTextInput::AlignRight : QQuickTextInput::AlignLeft); } @@ -727,7 +727,7 @@ void QQuickTextInput::setCursorVisible(bool on) if (on && isComponentComplete()) QQuickTextUtil::createCursor(d); if (!d->cursorItem) { - d->setCursorBlinkPeriod(on ? qApp->styleHints()->cursorFlashTime() : 0); + d->setCursorBlinkPeriod(on ? QGuiApplication::styleHints()->cursorFlashTime() : 0); d->updateType = QQuickTextInputPrivate::UpdatePaintNode; polish(); update(); @@ -1569,7 +1569,7 @@ void QQuickTextInput::mousePressEvent(QMouseEvent *event) d->selectPressed = true; QPointF distanceVector = d->pressPos - d->tripleClickStartPoint; if (d->hasPendingTripleClick() - && distanceVector.manhattanLength() < qApp->styleHints()->startDragDistance()) { + && distanceVector.manhattanLength() < QGuiApplication::styleHints()->startDragDistance()) { event->setAccepted(true); selectAll(); return; @@ -1598,7 +1598,7 @@ void QQuickTextInput::mouseMoveEvent(QMouseEvent *event) Q_D(QQuickTextInput); if (d->selectPressed) { - if (qAbs(int(event->localPos().x() - d->pressPos.x())) > qApp->styleHints()->startDragDistance()) + if (qAbs(int(event->localPos().x() - d->pressPos.x())) > QGuiApplication::styleHints()->startDragDistance()) setKeepMouseGrab(true); #ifndef QT_NO_IM @@ -1650,7 +1650,7 @@ bool QQuickTextInputPrivate::sendMouseEventToInputContext(QMouseEvent *event) int mousePos = tmp_cursor - m_cursor; if (mousePos >= 0 && mousePos <= m_textLayout.preeditAreaText().length()) { if (event->type() == QEvent::MouseButtonRelease) { - qApp->inputMethod()->invokeAction(QInputMethod::Click, mousePos); + QGuiApplication::inputMethod()->invokeAction(QInputMethod::Click, mousePos); } return true; } @@ -2598,7 +2598,7 @@ void QQuickTextInputPrivate::handleFocusEvent(QFocusEvent *event) #ifndef QT_NO_IM if (focusOnPress && !m_readOnly) qGuiApp->inputMethod()->show(); - q->connect(qApp->inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)), + q->connect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)), q, SLOT(q_updateAlignment())); #endif } else { @@ -2616,7 +2616,7 @@ void QQuickTextInputPrivate::handleFocusEvent(QFocusEvent *event) emit q->editingFinished(); #ifndef QT_NO_IM - q->disconnect(qApp->inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)), + q->disconnect(QGuiApplication::inputMethod(), SIGNAL(inputDirectionChanged(Qt::LayoutDirection)), q, SLOT(q_updateAlignment())); #endif } @@ -3009,7 +3009,7 @@ void QQuickTextInputPrivate::commitPreedit() if (!hasImState) return; - qApp->inputMethod()->commit(); + QGuiApplication::inputMethod()->commit(); if (!hasImState) return; @@ -3025,7 +3025,7 @@ void QQuickTextInputPrivate::cancelPreedit() if (!hasImState) return; - qApp->inputMethod()->reset(); + QGuiApplication::inputMethod()->reset(); QInputMethodEvent ev; QCoreApplication::sendEvent(q, &ev); diff --git a/src/quick/items/qquicktextinput_p_p.h b/src/quick/items/qquicktextinput_p_p.h index 7596eae570..3038573bb3 100644 --- a/src/quick/items/qquicktextinput_p_p.h +++ b/src/quick/items/qquicktextinput_p_p.h @@ -102,8 +102,8 @@ public: , updateType(UpdatePaintNode) , mouseSelectionMode(QQuickTextInput::SelectCharacters) , m_layoutDirection(Qt::LayoutDirectionAuto) - , m_passwordCharacter(qApp->styleHints()->passwordMaskCharacter()) - , m_passwordMaskDelay(qApp->styleHints()->passwordMaskDelay()) + , m_passwordCharacter(QGuiApplication::styleHints()->passwordMaskCharacter()) + , m_passwordMaskDelay(QGuiApplication::styleHints()->passwordMaskDelay()) , focusOnPress(true) , cursorVisible(false) , cursorPending(false) @@ -276,11 +276,11 @@ public: return t->d_func(); } bool hasPendingTripleClick() const { - return !tripleClickTimer.hasExpired(qApp->styleHints()->mouseDoubleClickInterval()); + return !tripleClickTimer.hasExpired(QGuiApplication::styleHints()->mouseDoubleClickInterval()); } void setNativeCursorEnabled(bool enabled) { - setCursorBlinkPeriod(enabled && cursorVisible ? qApp->styleHints()->cursorFlashTime() : 0); } + setCursorBlinkPeriod(enabled && cursorVisible ? QGuiApplication::styleHints()->cursorFlashTime() : 0); } int nextMaskBlank(int pos) { diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 521ff1c4bb..aabeefb317 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -85,10 +85,10 @@ void QQuickWindowPrivate::updateFocusItemTransform() Q_Q(QQuickWindow); #ifndef QT_NO_IM QQuickItem *focus = q->activeFocusItem(); - if (focus && qApp->focusObject() == focus) { + if (focus && QGuiApplication::focusObject() == focus) { QQuickItemPrivate *focusPrivate = QQuickItemPrivate::get(focus); - qApp->inputMethod()->setInputItemTransform(focusPrivate->itemToWindowTransform()); - qApp->inputMethod()->setInputItemRectangle(QRectF(0, 0, focusPrivate->width, focusPrivate->height)); + QGuiApplication::inputMethod()->setInputItemTransform(focusPrivate->itemToWindowTransform()); + QGuiApplication::inputMethod()->setInputItemRectangle(QRectF(0, 0, focusPrivate->width, focusPrivate->height)); } #endif } @@ -519,7 +519,7 @@ bool QQuickWindowPrivate::checkIfDoubleClicked(ulong newPressEventTimestamp) doubleClicked = false; } else { ulong timeBetweenPresses = newPressEventTimestamp - touchMousePressTimestamp; - ulong doubleClickInterval = static_cast(qApp->styleHints()-> + ulong doubleClickInterval = static_cast(QGuiApplication::styleHints()-> mouseDoubleClickInterval()); doubleClicked = timeBetweenPresses < doubleClickInterval; if (doubleClicked) { @@ -750,7 +750,7 @@ void QQuickWindowPrivate::setFocusInScope(QQuickItem *scope, QQuickItem *item, Q if (oldActiveFocusItem) { #ifndef QT_NO_IM - qApp->inputMethod()->commit(); + QGuiApplication::inputMethod()->commit(); #endif activeFocusItem = 0; @@ -847,7 +847,7 @@ void QQuickWindowPrivate::clearFocusInScope(QQuickItem *scope, QQuickItem *item, newActiveFocusItem = scope; #ifndef QT_NO_IM - qApp->inputMethod()->commit(); + QGuiApplication::inputMethod()->commit(); #endif activeFocusItem = 0; @@ -1348,7 +1348,7 @@ bool QQuickWindow::event(QEvent *e) QTouchEvent *touch = static_cast(e); d->translateTouchEvent(touch); d->deliverTouchEvent(touch); - if (Q_LIKELY(qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents))) { + if (Q_LIKELY(QCoreApplication::testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents))) { // we consume all touch events ourselves to avoid duplicate // mouse delivery by QtGui mouse synthesis e->accept(); @@ -1441,7 +1441,7 @@ void QQuickWindowPrivate::deliverKeyEvent(QKeyEvent *e) // toplevel non-popup window (the application current "key window") will // receive them. (QWidgetWindow does something similar for widgets, by keeping // a list of popup windows, and forwarding the key event to the top-most popup.) - QWindow *focusWindow = qApp->focusWindow(); + QWindow *focusWindow = QGuiApplication::focusWindow(); if (focusWindow && focusWindow != q && (focusWindow->flags() & Qt::Popup) == Qt::Popup) QGuiApplication::sendEvent(focusWindow, e); @@ -2440,7 +2440,7 @@ bool QQuickWindowPrivate::sendFilteredMouseEvent(QQuickItem *target, QQuickItem bool QQuickWindowPrivate::dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event, int startDragThreshold) { - QStyleHints *styleHints = qApp->styleHints(); + QStyleHints *styleHints = QGuiApplication::styleHints(); int caps = QGuiApplicationPrivate::mouseEventCaps(event); bool dragVelocityLimitAvailable = (caps & QTouchDevice::Velocity) && styleHints->startDragVelocity(); -- cgit v1.2.3