diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-02-21 15:36:01 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-22 17:28:51 +0100 |
commit | 541949aed23ea14a71a7d4391bac244b623add0a (patch) | |
tree | f123b0cfb7d4c42f7b83a378ae670c8b51003057 /src/widgets | |
parent | 53bb87d1d274a80b94595f6cd31bfa7a8ae81dc3 (diff) |
Add further theme hints to QPlatformTheme.
- Add hints for QDialog/QDialogButtonBox.
- Add hint for available popup-menu area.
- Add keyboard scheme hint replacing
QGuiApplicationPrivate::currentKeyPlatform()
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Task-number: QTBUG-24204
Task-number: QTBUG-24315
Change-Id: I6653786b0dcb49a6fc264d3b9891dbfee502bd3e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/dialogs/qdialog.cpp | 10 | ||||
-rw-r--r-- | src/widgets/kernel/qicon.cpp | 5 | ||||
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 19 |
3 files changed, 9 insertions, 25 deletions
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 <private/qt_cocoa_helpers_mac_p.h> #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 <private/qt_x11_p.h> -#elif defined(Q_WS_MAC) -# include <private/qt_cocoa_helpers_mac_p.h> -#endif - #include <private/qstylehelper_p.h> 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; |