Fix invocations of static methods of QGuiApplication/QApplication.

Change-Id: I99ba58763f6063fa2a6f511adbea0163cce7ea32
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
bb10
Friedemann Kleint 2015-02-23 17:13:09 +01:00
parent e4e8a8ac77
commit 7bbde34ee0
17 changed files with 53 additions and 53 deletions

View File

@ -163,7 +163,7 @@ QRectF QPlatformInputContext::keyboardRect() const
*/
void QPlatformInputContext::emitKeyboardRectChanged()
{
emit qApp->inputMethod()->keyboardRectangleChanged();
emit QGuiApplication::inputMethod()->keyboardRectangleChanged();
}
/*!
@ -182,7 +182,7 @@ bool QPlatformInputContext::isAnimating() const
*/
void QPlatformInputContext::emitAnimatingChanged()
{
emit qApp->inputMethod()->animatingChanged();
emit QGuiApplication::inputMethod()->animatingChanged();
}
/*!
@ -214,7 +214,7 @@ bool QPlatformInputContext::isInputPanelVisible() const
*/
void QPlatformInputContext::emitInputPanelVisibleChanged()
{
emit qApp->inputMethod()->visibleChanged();
emit QGuiApplication::inputMethod()->visibleChanged();
}
QLocale QPlatformInputContext::locale() const
@ -224,7 +224,7 @@ QLocale QPlatformInputContext::locale() const
void QPlatformInputContext::emitLocaleChanged()
{
emit qApp->inputMethod()->localeChanged();
emit QGuiApplication::inputMethod()->localeChanged();
}
Qt::LayoutDirection QPlatformInputContext::inputDirection() const
@ -234,7 +234,7 @@ Qt::LayoutDirection QPlatformInputContext::inputDirection() const
void QPlatformInputContext::emitInputDirectionChanged(Qt::LayoutDirection newDirection)
{
emit qApp->inputMethod()->inputDirectionChanged(newDirection);
emit QGuiApplication::inputMethod()->inputDirectionChanged(newDirection);
}
/*!

View File

@ -255,18 +255,18 @@ void QBasicDrag::updateCursor(Qt::DropAction action)
}
}
QCursor *cursor = qApp->overrideCursor();
QCursor *cursor = QGuiApplication::overrideCursor();
QPixmap pixmap = m_drag->dragCursor(action);
if (!cursor) {
qApp->changeOverrideCursor((pixmap.isNull()) ? QCursor(cursorShape) : QCursor(pixmap));
QGuiApplication::changeOverrideCursor((pixmap.isNull()) ? QCursor(cursorShape) : QCursor(pixmap));
} else {
if (!pixmap.isNull()) {
if ((cursor->pixmap().cacheKey() != pixmap.cacheKey())) {
qApp->changeOverrideCursor(QCursor(pixmap));
QGuiApplication::changeOverrideCursor(QCursor(pixmap));
}
} else {
if (cursorShape != cursor->shape()) {
qApp->changeOverrideCursor(QCursor(cursorShape));
QGuiApplication::changeOverrideCursor(QCursor(cursorShape));
}
}
}

View File

@ -1707,7 +1707,7 @@ bool QTextEngine::isRightToLeft() const
itemize();
// this places the cursor in the right position depending on the keyboard layout
if (layoutData->string.isEmpty())
return qApp ? qApp->inputMethod()->inputDirection() == Qt::RightToLeft : false;
return QGuiApplication::inputMethod()->inputDirection() == Qt::RightToLeft;
return layoutData->string.isRightToLeft();
}

View File

@ -361,7 +361,7 @@ bool QWindowsInputContext::startComposition(HWND hwnd)
if (!fo)
return false;
// This should always match the object.
QWindow *window = qApp->focusWindow();
QWindow *window = QGuiApplication::focusWindow();
if (!window)
return false;
qCDebug(lcQpaInputMethods) << __FUNCTION__ << fo << window;
@ -561,7 +561,7 @@ bool QWindowsInputContext::handleIME_Request(WPARAM wParam,
int QWindowsInputContext::reconvertString(RECONVERTSTRING *reconv)
{
QObject *fo = qApp->focusObject();
QObject *fo = QGuiApplication::focusObject();
if (!fo)
return false;

View File

@ -7390,7 +7390,7 @@ void QGraphicsItem::setInputMethodHints(Qt::InputMethodHints hints)
QWidget *fw = QApplication::focusWidget();
if (!fw)
return;
qApp->inputMethod()->update(Qt::ImHints);
QGuiApplication::inputMethod()->update(Qt::ImHints);
}
/*!
@ -7408,7 +7408,7 @@ void QGraphicsItem::updateMicroFocus()
for (int i = 0 ; i < scene()->views().count() ; ++i) {
if (scene()->views().at(i) == fw) {
if (qApp)
qApp->inputMethod()->update(Qt::ImQueryAll);
QGuiApplication::inputMethod()->update(Qt::ImQueryAll);
break;
}
}
@ -10141,9 +10141,9 @@ bool QGraphicsTextItem::sceneEvent(QEvent *event)
// Reset the focus widget's input context, regardless
// of how this item gained or lost focus.
if (event->type() == QEvent::FocusIn || event->type() == QEvent::FocusOut) {
qApp->inputMethod()->reset();
QGuiApplication::inputMethod()->reset();
} else {
qApp->inputMethod()->update(Qt::ImQueryInput);
QGuiApplication::inputMethod()->update(Qt::ImQueryInput);
}
break;
case QEvent::ShortcutOverride:

View File

@ -847,7 +847,7 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
// the views, but if we are changing focus, we have to
// do it ourselves.
if (qApp)
qApp->inputMethod()->commit();
QGuiApplication::inputMethod()->commit();
}
#endif //QT_NO_IM

View File

@ -2151,7 +2151,7 @@ void QApplication::setActiveWindow(QWidget* act)
if (QApplicationPrivate::focus_widget) {
if (QApplicationPrivate::focus_widget->testAttribute(Qt::WA_InputMethodEnabled))
qApp->inputMethod()->commit();
QGuiApplication::inputMethod()->commit();
QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange, Qt::ActiveWindowFocusReason);
QApplication::sendEvent(QApplicationPrivate::focus_widget, &focusAboutToChange);

View File

@ -165,9 +165,9 @@ public:
#if QT_DEPRECATED_SINCE(5, 0)
QT_DEPRECATED static QLocale keyboardInputLocale()
{ return qApp ? qApp->inputMethod()->locale() : QLocale::c(); }
{ return qApp ? QGuiApplication::inputMethod()->locale() : QLocale::c(); }
QT_DEPRECATED static Qt::LayoutDirection keyboardInputDirection()
{ return qApp ? qApp->inputMethod()->inputDirection() : Qt::LeftToRight; }
{ return qApp ? QGuiApplication::inputMethod()->inputDirection() : Qt::LeftToRight; }
#endif
static int exec();

View File

@ -618,7 +618,7 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
if (gesture->hasHotSpot()) {
// guess the target widget using the hotspot of the gesture
QPoint pt = gesture->hotSpot().toPoint();
if (QWidget *topLevel = qApp->topLevelAt(pt)) {
if (QWidget *topLevel = QApplication::topLevelAt(pt)) {
QWidget *child = topLevel->childAt(topLevel->mapFromGlobal(pt));
target = child ? child : topLevel;
}

View File

@ -359,12 +359,12 @@ void QWidgetPrivate::setWSGeometry()
void QWidgetPrivate::updateWidgetTransform(QEvent *event)
{
Q_Q(QWidget);
if (q == qGuiApp->focusObject() || event->type() == QEvent::FocusIn) {
if (q == QGuiApplication::focusObject() || event->type() == QEvent::FocusIn) {
QTransform t;
QPoint p = q->mapTo(q->topLevelWidget(), QPoint(0,0));
t.translate(p.x(), p.y());
qApp->inputMethod()->setInputItemTransform(t);
qApp->inputMethod()->setInputItemRectangle(q->rect());
QGuiApplication::inputMethod()->setInputItemTransform(t);
QGuiApplication::inputMethod()->setInputItemRectangle(q->rect());
}
}
@ -3401,10 +3401,10 @@ void QWidgetPrivate::setEnabled_helper(bool enable)
if (enable) {
if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled))
qApp->inputMethod()->update(Qt::ImEnabled);
QGuiApplication::inputMethod()->update(Qt::ImEnabled);
} else {
qApp->inputMethod()->commit();
qApp->inputMethod()->update(Qt::ImEnabled);
QGuiApplication::inputMethod()->commit();
QGuiApplication::inputMethod()->update(Qt::ImEnabled);
}
}
#endif //QT_NO_IM
@ -6427,7 +6427,7 @@ void QWidget::setFocus(Qt::FocusReason reason)
if (prev) {
if (reason != Qt::PopupFocusReason && reason != Qt::MenuBarFocusReason
&& prev->testAttribute(Qt::WA_InputMethodEnabled)) {
qApp->inputMethod()->commit();
QGuiApplication::inputMethod()->commit();
}
if (reason != Qt::NoFocusReason) {
@ -6550,7 +6550,7 @@ void QWidget::clearFocus()
{
if (hasFocus()) {
if (testAttribute(Qt::WA_InputMethodEnabled))
qApp->inputMethod()->commit();
QGuiApplication::inputMethod()->commit();
QFocusEvent focusAboutToChange(QEvent::FocusAboutToChange);
QApplication::sendEvent(this, &focusAboutToChange);
@ -9429,7 +9429,7 @@ void QWidget::focusOutEvent(QFocusEvent *)
#ifndef Q_OS_IOS
// FIXME: revisit autoSIP logic, QTBUG-42906
if (qApp->autoSipEnabled() && testAttribute(Qt::WA_InputMethodEnabled))
qApp->inputMethod()->hide();
QGuiApplication::inputMethod()->hide();
#endif
}
@ -9718,8 +9718,8 @@ void QWidget::setInputMethodHints(Qt::InputMethodHints hints)
if (d->imHints == hints)
return;
d->imHints = hints;
if (this == qApp->focusObject())
qApp->inputMethod()->update(Qt::ImHints);
if (this == QGuiApplication::focusObject())
QGuiApplication::inputMethod()->update(Qt::ImHints);
#endif //QT_NO_IM
}
@ -11061,18 +11061,18 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
d->createTLSysExtra();
#ifndef QT_NO_IM
QWidget *focusWidget = d->effectiveFocusWidget();
if (on && !internalWinId() && this == qApp->focusObject()
if (on && !internalWinId() && this == QGuiApplication::focusObject()
&& focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) {
qApp->inputMethod()->commit();
qApp->inputMethod()->update(Qt::ImEnabled);
QGuiApplication::inputMethod()->commit();
QGuiApplication::inputMethod()->update(Qt::ImEnabled);
}
if (!qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget())
parentWidget()->d_func()->enforceNativeChildren();
if (on && !internalWinId() && testAttribute(Qt::WA_WState_Created))
d->createWinId();
if (isEnabled() && focusWidget->isEnabled() && this == qApp->focusObject()
if (isEnabled() && focusWidget->isEnabled() && this == QGuiApplication::focusObject()
&& focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) {
qApp->inputMethod()->update(Qt::ImEnabled);
QGuiApplication::inputMethod()->update(Qt::ImEnabled);
}
#endif //QT_NO_IM
break;
@ -11105,10 +11105,10 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
break;
case Qt::WA_InputMethodEnabled: {
#ifndef QT_NO_IM
if (qApp->focusObject() == this) {
if (QGuiApplication::focusObject() == this) {
if (!on)
qApp->inputMethod()->commit();
qApp->inputMethod()->update(Qt::ImEnabled);
QGuiApplication::inputMethod()->commit();
QGuiApplication::inputMethod()->update(Qt::ImEnabled);
}
#endif //QT_NO_IM
break;
@ -11596,8 +11596,8 @@ void QWidget::setShortcutAutoRepeat(int id, bool enable)
void QWidget::updateMicroFocus()
{
// updating everything since this is currently called for any kind of state change
if (this == qApp->focusObject())
qApp->inputMethod()->update(Qt::ImQueryAll);
if (this == QGuiApplication::focusObject())
QGuiApplication::inputMethod()->update(Qt::ImQueryAll);
}
/*!

View File

@ -598,7 +598,7 @@ public:
QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
q->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) {
qApp->inputMethod()->show();
QGuiApplication::inputMethod()->show();
}
}
}

View File

@ -191,7 +191,7 @@ bool QWidgetWindow::event(QEvent *event)
case QEvent::FocusAboutToChange:
if (QApplicationPrivate::focus_widget) {
if (QApplicationPrivate::focus_widget->testAttribute(Qt::WA_InputMethodEnabled))
qApp->inputMethod()->commit();
QGuiApplication::inputMethod()->commit();
QGuiApplication::sendSpontaneousEvent(QApplicationPrivate::focus_widget, event);
}

View File

@ -2646,7 +2646,7 @@ void QComboBox::showPopup()
}
if (qApp) {
qApp->inputMethod()->reset();
QGuiApplication::inputMethod()->reset();
}
QScrollBar *sb = view()->horizontalScrollBar();

View File

@ -250,7 +250,7 @@ void QLineEditPrivate::resetInputMethod()
{
Q_Q(QLineEdit);
if (q->hasFocus() && qApp) {
qApp->inputMethod()->reset();
QGuiApplication::inputMethod()->reset();
}
}
@ -270,7 +270,7 @@ bool QLineEditPrivate::sendMouseEventToInputContext( QMouseEvent *e )
if (mousePos >= 0) {
if (e->type() == QEvent::MouseButtonRelease)
qApp->inputMethod()->invokeAction(QInputMethod::Click, mousePos);
QGuiApplication::inputMethod()->invokeAction(QInputMethod::Click, mousePos);
return true;
}

View File

@ -183,7 +183,7 @@ void QWidgetLineControl::commitPreedit()
if (!composeMode())
return;
qApp->inputMethod()->commit();
QGuiApplication::inputMethod()->commit();
if (!composeMode())
return;

View File

@ -230,7 +230,7 @@ public:
{
#ifndef QT_NO_IM
if (composeMode())
qApp->inputMethod()->reset();
QGuiApplication::inputMethod()->reset();
#endif
internalSetText(txt, -1, false);
}
@ -328,7 +328,7 @@ public:
Qt::LayoutDirection layoutDirection() const {
if (m_layoutDirection == Qt::LayoutDirectionAuto) {
if (m_text.isEmpty())
return qApp->inputMethod()->inputDirection();
return QGuiApplication::inputMethod()->inputDirection();
return m_text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight;
}
return m_layoutDirection;

View File

@ -1739,7 +1739,7 @@ void QWidgetTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button
_q_updateCurrentCharFormatAndSelection();
#ifndef QT_NO_IM
if (contextWidget)
qApp->inputMethod()->update(Qt::ImQueryInput);
QGuiApplication::inputMethod()->update(Qt::ImQueryInput);
#endif //QT_NO_IM
} else {
//emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1)));
@ -1887,7 +1887,7 @@ bool QWidgetTextControlPrivate::sendMouseEventToInputContext(
if (cursorPos >= 0) {
if (eventType == QEvent::MouseButtonRelease)
qApp->inputMethod()->invokeAction(QInputMethod::Click, cursorPos);
QGuiApplication::inputMethod()->invokeAction(QInputMethod::Click, cursorPos);
e->setAccepted(true);
return true;
@ -2867,7 +2867,7 @@ void QWidgetTextControlPrivate::commitPreedit()
if (!isPreediting())
return;
qApp->inputMethod()->commit();
QGuiApplication::inputMethod()->commit();
if (!isPreediting())
return;