diff options
Diffstat (limited to 'src/widgets/kernel/qapplication.cpp')
-rw-r--r-- | src/widgets/kernel/qapplication.cpp | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 26e9ffbbf0..9e4910ebd0 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -152,20 +152,6 @@ static void clearSystemPalette() QApplicationPrivate::sys_pal = 0; } -static QByteArray get_style_class_name() -{ - QScopedPointer<QStyle> s(QStyleFactory::create(QApplicationPrivate::desktopStyleKey())); - if (!s.isNull()) - return s->metaObject()->className(); - return QByteArray(); -} - -static QByteArray nativeStyleClassName() -{ - static QByteArray name = get_style_class_name(); - return name; -} - bool QApplicationPrivate::autoSipEnabled = true; QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, int flags) @@ -395,8 +381,6 @@ void qt_init_tooltip_palette(); void qt_cleanup(); QStyle *QApplicationPrivate::app_style = 0; // default application style -bool QApplicationPrivate::overrides_native_style = false; // whether native QApplication style is - // overridden, i.e. not native #ifndef QT_NO_STYLE_STYLESHEET QString QApplicationPrivate::styleSheet; // default application stylesheet #endif @@ -1091,8 +1075,6 @@ QStyle *QApplication::style() Q_ASSERT(!"No styles available!"); return 0; } - QApplicationPrivate::overrides_native_style = - app_style->objectName() != QApplicationPrivate::desktopStyleKey(); } // take ownership of the style QApplicationPrivate::app_style->setParent(qApp); @@ -1157,9 +1139,6 @@ void QApplication::setStyle(QStyle *style) QStyle *old = QApplicationPrivate::app_style; // save - QApplicationPrivate::overrides_native_style = - nativeStyleClassName() == QByteArray(style->metaObject()->className()); - #ifndef QT_NO_STYLE_STYLESHEET if (!QApplicationPrivate::styleSheet.isEmpty() && !qobject_cast<QStyleSheetStyle *>(style)) { // we have a stylesheet already and a new style is being set @@ -1236,7 +1215,7 @@ void QApplication::setStyle(QStyle *style) Requests a QStyle object for \a style from the QStyleFactory. The string must be one of the QStyleFactory::keys(), typically one of - "windows", "fusion", "windowsxp", or "macintosh". Style + "windows", "windowsvista", "fusion", or "macintosh". Style names are case insensitive. Returns 0 if an unknown \a style is passed, otherwise the QStyle object @@ -1479,8 +1458,8 @@ void QApplicationPrivate::setPalette_helper(const QPalette &palette, const char* "selection-background-color" and "alternate-background-color". \note Some styles do not use the palette for all drawing, for instance, if - they make use of native theme engines. This is the case for the Windows XP, - Windows Vista, and \macos styles. + they make use of native theme engines. This is the case for the + Windows Vista and \macos styles. \sa QWidget::setPalette(), palette(), QStyle::polish() */ @@ -2228,8 +2207,15 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool if (test->isWindow()) seenWindow = true; + // If the next focus widget has a focus proxy, we need to check to ensure + // that the proxy is in the correct parent-child direction (according to + // \a next). This is to ensure that we can tab in and out of compound widgets + // without getting stuck in a tab-loop between parent and child. + QWidget *focusProxy = test->d_func()->deepestFocusProxy(); + if ((test->focusPolicy() & focus_flag) == focus_flag - && !(test->d_func()->extra && test->d_func()->extra->focus_proxy) + && !(next && focusProxy && focusProxy->isAncestorOf(test)) + && !(!next && focusProxy && test->isAncestorOf(focusProxy)) && test->isVisibleTo(toplevel) && test->isEnabled() && !(w->windowType() == Qt::SubWindow && !w->isAncestorOf(test)) && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))) { @@ -2735,7 +2721,7 @@ bool QApplicationPrivate::sendMouseEvent(QWidget *receiver, QMouseEvent *event, case enter/leave events are genereated by the underlying windowing system. */ extern QPointer<QWidget> qt_last_mouse_receiver; -extern QWidget *qt_button_down; +extern Q_WIDGETS_EXPORT QWidget *qt_button_down; void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) { #ifndef QT_NO_CURSOR @@ -2797,7 +2783,7 @@ void QApplicationPrivate::sendSyntheticEnterLeave(QWidget *widget) */ QDesktopWidget *QApplication::desktop() { - CHECK_QAPP_INSTANCE(Q_NULLPTR) + CHECK_QAPP_INSTANCE(nullptr) if (!qt_desktopWidget || // not created yet !(qt_desktopWidget->windowType() == Qt::Desktop)) { // reparented away qt_desktopWidget = new QDesktopWidget(); @@ -2964,6 +2950,9 @@ bool QApplication::notify(QObject *receiver, QEvent *e) // required in order to support Qt Test synthesized events. Real mouse // and keyboard state updates from the platform plugin are managed by // QGuiApplicationPrivate::process(Mouse|Wheel|Key|Touch|Tablet)Event(); + // ### FIXME: Qt Test should not call qapp->notify(), but rather route + // the events through the proper QPA interface. This is required to + // properly generate all other events such as enter/leave etc. switch (e->type()) { case QEvent::MouseButtonPress: { @@ -3068,7 +3057,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: d->toolTipFallAsleep.stop(); - // fall-through + Q_FALLTHROUGH(); case QEvent::Leave: d->toolTipWakeUp.stop(); default: @@ -3274,7 +3263,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) // sequence, so we reset wheel_widget in case no one accepts the event // or if we didn't get (or missed) a ScrollEnd previously. if (spontaneous && phase == Qt::ScrollBegin) - QApplicationPrivate::wheel_widget = Q_NULLPTR; + QApplicationPrivate::wheel_widget = nullptr; const QPoint &relpos = wheel->pos(); @@ -3324,7 +3313,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) d->notify_helper(QApplicationPrivate::wheel_widget, &we); wheel->setAccepted(we.isAccepted()); if (phase == Qt::ScrollEnd) - QApplicationPrivate::wheel_widget = Q_NULLPTR; + QApplicationPrivate::wheel_widget = nullptr; } } break; @@ -3760,7 +3749,6 @@ static void grabForPopup(QWidget *popup) } } -extern QWidget *qt_button_down; extern QWidget *qt_popup_down; extern bool qt_replay_popup_mouse_event; |