diff options
Diffstat (limited to 'src/widgets/styles/qwindowsstyle.cpp')
-rw-r--r-- | src/widgets/styles/qwindowsstyle.cpp | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index 7b5da9bfa8..c13f6e637d 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -84,6 +84,7 @@ #include <qpa/qplatformscreen.h> #include <private/qguiapplication_p.h> #include <private/qhighdpiscaling_p.h> +#include <private/qwidget_p.h> #include <private/qstylehelper_p.h> #if QT_CONFIG(animation) @@ -244,11 +245,12 @@ void QWindowsStyle::polish(QApplication *app) if (!proxy()->styleHint(SH_UnderlineShortcut, 0) && app) app->installEventFilter(this); - d->activeCaptionColor = app->palette().highlight().color(); - d->activeGradientCaptionColor = app->palette().highlight() .color(); - d->inactiveCaptionColor = app->palette().dark().color(); - d->inactiveGradientCaptionColor = app->palette().dark().color(); - d->inactiveCaptionText = app->palette().window().color(); + const auto &palette = QGuiApplication::palette(); + d->activeGradientCaptionColor = palette.highlight().color(); + d->activeCaptionColor = d->activeGradientCaptionColor; + d->inactiveGradientCaptionColor = palette.dark().color(); + d->inactiveCaptionColor = d->inactiveGradientCaptionColor; + d->inactiveCaptionText = palette.window().color(); #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) //fetch native title bar colors if(app->desktopSettingsAware()){ @@ -380,23 +382,12 @@ int QWindowsStylePrivate::fixedPixelMetric(QStyle::PixelMetric pm) return QWindowsStylePrivate::InvalidMetric; } -static QWindow *windowOf(const QWidget *w) +static QScreen *screenOf(const QWidget *w) { - QWindow *result = nullptr; if (w) { - result = w->windowHandle(); - if (!result) { - if (const QWidget *np = w->nativeParentWidget()) - result = np->windowHandle(); - } + if (auto screen = qt_widget_private(const_cast<QWidget *>(w))->associatedScreen()) + return screen; } - return result; -} - -static QScreen *screenOf(const QWidget *w) -{ - if (const QWindow *window = windowOf(w)) - return window->screen(); return QGuiApplication::primaryScreen(); } |