diff options
Diffstat (limited to 'src/widgets/kernel/qapplication.cpp')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 76 |
1 files changed, 29 insertions, 47 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index abd0231b00..d19087bd8d 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -64,6 +64,7 @@ #include <QtWidgets/qgraphicsproxywidget.h> #include <QtGui/qstylehints.h> #include <QtGui/qinputmethod.h> +#include <QtGui/private/qwindow_p.h> #include <qpa/qplatformtheme.h> #ifndef QT_NO_WHATSTHIS #include <QtWidgets/QWhatsThis> @@ -431,9 +432,7 @@ inline bool QApplicationPrivate::isAlien(QWidget *widget) bool Q_WIDGETS_EXPORT qt_tab_all_widgets() { - if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) - return theme->themeHint(QPlatformTheme::TabAllWidgets).toBool(); - return true; + return QGuiApplication::styleHints()->tabFocusBehavior() == Qt::TabFocusAllControls; } // ######## move to QApplicationPrivate @@ -629,6 +628,9 @@ void QApplicationPrivate::initialize() // needed for a static build. qRegisterWidgetsVariant(); + // needed for widgets in QML + QAbstractDeclarativeData::setWidgetParent = QWidgetPrivate::setWidgetParentHelper; + if (application_type != QApplicationPrivate::Tty) (void) QApplication::style(); // trigger creation of application style #ifndef QT_NO_STATEMACHINE @@ -636,7 +638,7 @@ void QApplicationPrivate::initialize() qRegisterGuiStateMachine(); #endif - if (qgetenv("QT_USE_NATIVE_WINDOWS").toInt() > 0) + if (qEnvironmentVariableIntValue("QT_USE_NATIVE_WINDOWS") > 0) QCoreApplication::setAttribute(Qt::AA_NativeWindows); #ifdef Q_OS_WINCE @@ -658,8 +660,12 @@ void QApplicationPrivate::initialize() initializeMultitouch(); if (QApplication::desktopSettingsAware()) - if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) + if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) { QApplicationPrivate::enabledAnimations = theme->themeHint(QPlatformTheme::UiEffects).toInt(); +#ifndef QT_NO_WHEELEVENT + QApplicationPrivate::wheel_scroll_lines = theme->themeHint(QPlatformTheme::WheelScrollLines).toInt(); +#endif + } is_app_running = true; // no longer starting up } @@ -2485,7 +2491,7 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin } QWidget *popupWidget = QApplication::activePopupWidget(); QWindow *popupWindow = popupWidget ? popupWidget->windowHandle() : 0; - if (popupWindow == window) { + if (popupWindow == window || (!popupWindow && QWindowPrivate::get(window)->isPopup())) { *blockingWindow = 0; return false; } @@ -3122,39 +3128,15 @@ bool QApplication::notify(QObject *receiver, QEvent *e) } switch (e->type()) { - case QEvent::KeyPress: - { - bool isWidget = receiver->isWidgetType(); - bool isWindow = receiver->isWindowType(); - bool isGraphicsWidget = false; -#ifndef QT_NO_GRAPHICSVIEW - isGraphicsWidget = !isWidget && !isWindow && qobject_cast<QGraphicsWidget *>(receiver); -#endif - if (!isWidget && !isGraphicsWidget && !isWindow) { - return d->notify_helper(receiver, e); - } - - QKeyEvent* key = static_cast<QKeyEvent*>(e); -#ifndef QT_NO_SHORTCUT - // Try looking for a Shortcut before sending key events - QObject *shortcutReceiver = receiver; - if (!isWidget && isWindow) { - QWindow *w = qobject_cast<QWindow *>(receiver); - QObject *focus = w ? w->focusObject() : 0; - if (focus) - shortcutReceiver = focus; - } - if (qApp->d_func()->shortcutMap.tryShortcutEvent(shortcutReceiver, key)) - return true; -#endif - qt_in_tab_key_event = (key->key() == Qt::Key_Backtab - || key->key() == Qt::Key_Tab - || key->key() == Qt::Key_Left - || key->key() == Qt::Key_Up - || key->key() == Qt::Key_Right - || key->key() == Qt::Key_Down); - - } + case QEvent::KeyPress: { + int key = static_cast<QKeyEvent*>(e)->key(); + qt_in_tab_key_event = (key == Qt::Key_Backtab + || key == Qt::Key_Tab + || key == Qt::Key_Left + || key == Qt::Key_Up + || key == Qt::Key_Right + || key == Qt::Key_Down); + } default: break; } @@ -3334,7 +3316,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) while (w) { QWheelEvent we(relpos, wheel->globalPos(), wheel->pixelDelta(), wheel->angleDelta(), wheel->delta(), wheel->orientation(), wheel->buttons(), - wheel->modifiers(), wheel->phase()); + wheel->modifiers(), wheel->phase(), wheel->source()); we.spont = wheel->spontaneous(); res = d->notify_helper(w, w == receiver ? wheel : &we); eventAccepted = ((w == receiver) ? wheel : &we)->isAccepted(); |