From 59096732f6fe9b922df2dd65c9eff4edcc444ce2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 16 Jul 2012 12:24:27 +0200 Subject: Use DropShadow from QPlatformTheme everywhere in qwhatsthis.cpp. Change-Id: Ib8281d44e2d4b51aba13417c26247d3e19b1b2f8 Reviewed-by: Joerg Bornemann --- src/widgets/kernel/qwhatsthis.cpp | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp index e135884cff..9e98767ab7 100644 --- a/src/widgets/kernel/qwhatsthis.cpp +++ b/src/widgets/kernel/qwhatsthis.cpp @@ -172,6 +172,13 @@ static int shadowWidth = 6; // also used as '5' and '6' and even '8' below static const int vMargin = 8; static const int hMargin = 12; +static inline bool dropShadow() +{ + if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) + return theme->themeHint(QPlatformTheme::DropShadow).toBool(); + return false; +} + QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor) : QWidget(parent, Qt::Popup), widget(showTextFor), pressed(false), text(txt) @@ -218,9 +225,7 @@ QWhatsThat::QWhatsThat(const QString& txt, QWidget* parent, QWidget *showTextFor + Qt::TextWordWrap + Qt::TextExpandTabs, text); } - shadowWidth = - QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::DropShadow).toBool() ? - 0 : 6; + shadowWidth = dropShadow() ? 0 : 6; resize(r.width() + 2*hMargin + shadowWidth, r.height() + 2*vMargin + shadowWidth); } @@ -289,18 +294,7 @@ void QWhatsThat::keyPressEvent(QKeyEvent*) void QWhatsThat::paintEvent(QPaintEvent*) { - bool drawShadow = true; -#if defined(Q_WS_WIN) - if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP - && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based))) - { - BOOL shadow; - SystemParametersInfo(SPI_GETDROPSHADOW, 0, &shadow, 0); - drawShadow = !shadow; - } -#elif defined(Q_WS_MAC) - drawShadow = false; // never draw it on OS X or QWS, as we get it for free -#endif + const bool drawShadow = dropShadow(); QRect r = rect(); r.adjust(0, 0, -1, -1); -- cgit v1.2.3