From 541949aed23ea14a71a7d4391bac244b623add0a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 21 Feb 2012 15:36:01 +0100 Subject: Add further theme hints to QPlatformTheme. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add hints for QDialog/QDialogButtonBox. - Add hint for available popup-menu area. - Add keyboard scheme hint replacing QGuiApplicationPrivate::currentKeyPlatform() Reviewed-by: Samuel Rødal Reviewed-by: Morten Johan Sørvig Task-number: QTBUG-24204 Task-number: QTBUG-24315 Change-Id: I6653786b0dcb49a6fc264d3b9891dbfee502bd3e Reviewed-by: Friedemann Kleint --- src/widgets/dialogs/qdialog.cpp | 10 +++++----- src/widgets/kernel/qicon.cpp | 5 ----- src/widgets/styles/qcommonstyle.cpp | 19 ++++--------------- 3 files changed, 9 insertions(+), 25 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp index 49b4dd3a23..5ffb5466d6 100644 --- a/src/widgets/dialogs/qdialog.cpp +++ b/src/widgets/dialogs/qdialog.cpp @@ -55,6 +55,7 @@ #include "qplatformtheme_qpa.h" #include "private/qdialog_p.h" #include "private/qguiapplication_p.h" +#include "qplatformtheme_qpa.h" #ifndef QT_NO_ACCESSIBILITY #include "qaccessible.h" #endif @@ -790,11 +791,10 @@ void QDialog::showEvent(QShowEvent *event) /*! \internal */ void QDialog::adjustPosition(QWidget* w) { -#ifdef Q_WS_X11 - // if the WM advertises that it will place the windows properly for us, let it do it :) - if (X11->isSupportedByWM(ATOM(_NET_WM_FULL_PLACEMENT))) - return; -#endif + + if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) + if (theme->themeHint(QPlatformTheme::WindowAutoPlacement).toBool()) + return; QPoint p(0, 0); int extraw = 0, extrah = 0, scrn = 0; if (w) diff --git a/src/widgets/kernel/qicon.cpp b/src/widgets/kernel/qicon.cpp index e579fac4f4..eebd57f97e 100644 --- a/src/widgets/kernel/qicon.cpp +++ b/src/widgets/kernel/qicon.cpp @@ -60,11 +60,6 @@ #include #endif -#ifdef Q_WS_X11 -#include "private/qt_x11_p.h" -#include "private/qkde_p.h" -#endif - #include "private/qhexstring_p.h" #ifndef QT_NO_ICON diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 75476faeeb..174e94e63d 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -83,12 +83,6 @@ # include "private/qtextengine_p.h" #endif -#ifdef Q_WS_X11 -# include -#elif defined(Q_WS_MAC) -# include -#endif - #include QT_BEGIN_NAMESPACE @@ -4920,12 +4914,8 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget break; case SH_DialogButtonLayout: ret = QDialogButtonBox::WinLayout; -#ifdef Q_WS_X11 - if (X11->desktopEnvironment == DE_KDE) - ret = QDialogButtonBox::KdeLayout; - else if (X11->desktopEnvironment == DE_GNOME) - ret = QDialogButtonBox::GnomeLayout; -#endif + if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) + ret = theme->themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt(); break; case SH_ComboBox_PopupFrameStyle: ret = QFrame::StyledPanel | QFrame::Plain; @@ -4934,10 +4924,9 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget ret = Qt::LinksAccessibleByMouse; break; case SH_DialogButtonBox_ButtonsHaveIcons: -#ifdef Q_WS_X11 - return true; -#endif ret = 0; + if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) + ret = theme->themeHint(QPlatformTheme::DialogButtonBoxButtonsHaveIcons).toBool() ? 1 : 0; break; case SH_SpellCheckUnderlineStyle: ret = QTextCharFormat::WaveUnderline; -- cgit v1.2.3