diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-07-16 12:24:27 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-16 14:22:55 +0200 |
commit | 59096732f6fe9b922df2dd65c9eff4edcc444ce2 (patch) | |
tree | 9191797c9bae27272335da417ca7ec0bdad77bba /src/widgets | |
parent | a51f37a43070160c2fe45555f8f42e1e16f06111 (diff) |
Use DropShadow from QPlatformTheme everywhere in qwhatsthis.cpp.
Change-Id: Ib8281d44e2d4b51aba13417c26247d3e19b1b2f8
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qwhatsthis.cpp | 24 |
1 files 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); |