diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2012-11-23 14:31:49 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-30 19:31:29 +0100 |
commit | cd31c065900e5a6cd124a9a08b5d1e7e08dbca80 (patch) | |
tree | 0312983928900bb07dd01ed47d5a6284a01c6990 /src | |
parent | 2bda681eb6fe4f77ba13b7a1f9e23aa0abcc11f6 (diff) |
Made QWindowsStyle internal
We will take this opportunity to remove various QStyle specializations
from the public API in Qt5. This gives us much more freedom, for
example changing the inheritance hierarchy, pluginizing etc. without
worrying about BC.
=> Use QStyleFactory and/or QProxyStyle instead of creating an instance
or inheriting QWindowsStyle directly.
Change-Id: Ic17c7e425535bc5bb3a08620e9059bb0aea5185e
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/dialogs/qfiledialog.cpp | 2 | ||||
-rw-r--r-- | src/widgets/styles/qgtkstyle_p.h | 2 | ||||
-rw-r--r-- | src/widgets/styles/qstylefactory.cpp | 2 | ||||
-rw-r--r-- | src/widgets/styles/qstylesheetstyle.cpp | 5 | ||||
-rw-r--r-- | src/widgets/styles/qstylesheetstyle_p.h | 2 | ||||
-rw-r--r-- | src/widgets/styles/qwindowscestyle_p.h | 2 | ||||
-rw-r--r-- | src/widgets/styles/qwindowscestyle_p_p.h | 2 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsmobilestyle_p.h | 2 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsmobilestyle_p_p.h | 2 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsstyle.cpp | 3 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsstyle_p.h | 97 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsstyle_p_p.h (renamed from src/widgets/styles/qwindowsstyle.h) | 103 | ||||
-rw-r--r-- | src/widgets/styles/qwindowsxpstyle_p_p.h | 2 | ||||
-rw-r--r-- | src/widgets/styles/styles.pri | 3 |
14 files changed, 115 insertions, 114 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index 24a610a69f..fc8b62d75e 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -304,7 +304,7 @@ Q_WIDGETS_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_h QT_BEGIN_INCLUDE_NAMESPACE #ifdef Q_WS_WIN -#include <qwindowsstyle.h> +#include <qwindowsstyle_p.h> #endif #include <qshortcut.h> #ifdef Q_WS_MAC diff --git a/src/widgets/styles/qgtkstyle_p.h b/src/widgets/styles/qgtkstyle_p.h index c12474a4d4..07f4d41697 100644 --- a/src/widgets/styles/qgtkstyle_p.h +++ b/src/widgets/styles/qgtkstyle_p.h @@ -42,7 +42,7 @@ #ifndef QGTKSTYLE_P_H #define QGTKSTYLE_P_H -#include <QtWidgets/QWindowsStyle> +#include <private/qwindowsstyle_p.h> #include <QtGui/QPalette> #include <QtGui/QFont> #include <QtWidgets/QFileDialog> diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp index 1d61f37384..33201e45ba 100644 --- a/src/widgets/styles/qstylefactory.cpp +++ b/src/widgets/styles/qstylefactory.cpp @@ -45,7 +45,7 @@ #include "qmutex.h" #include "qapplication.h" -#include "qwindowsstyle.h" +#include "qwindowsstyle_p.h" #ifndef QT_NO_STYLE_FUSION #include "qfusionstyle_p.h" #endif diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 17ed82c730..b1f1de3462 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -52,9 +52,8 @@ #include <qpainter.h> #include <qstyleoption.h> #include <qlineedit.h> -#include <qwindowsstyle.h> +#include <private/qwindowsstyle_p.h> #include <qcombobox.h> -#include <qwindowsstyle.h> #include "private/qcssparser_p.h" #include "private/qmath_p.h" #include <qabstractscrollarea.h> @@ -69,7 +68,7 @@ #include <qcheckbox.h> #include <qstatusbar.h> #include <qheaderview.h> -#include <private/qwindowsstyle_p.h> +#include <private/qwindowsstyle_p_p.h> #include <private/qstyleanimation_p.h> #include <qtabbar.h> #include <QMetaProperty> diff --git a/src/widgets/styles/qstylesheetstyle_p.h b/src/widgets/styles/qstylesheetstyle_p.h index f42c0e9b20..205e5a7785 100644 --- a/src/widgets/styles/qstylesheetstyle_p.h +++ b/src/widgets/styles/qstylesheetstyle_p.h @@ -42,7 +42,7 @@ #ifndef QSTYLESHEETSTYLE_P_H #define QSTYLESHEETSTYLE_P_H -#include "QtWidgets/qwindowsstyle.h" +#include "private/qwindowsstyle_p.h" #ifndef QT_NO_STYLE_STYLESHEET diff --git a/src/widgets/styles/qwindowscestyle_p.h b/src/widgets/styles/qwindowscestyle_p.h index 00dcfb1fc0..cadcb98553 100644 --- a/src/widgets/styles/qwindowscestyle_p.h +++ b/src/widgets/styles/qwindowscestyle_p.h @@ -42,7 +42,7 @@ #ifndef QWINDOWSCESTYLE_P_H #define QWINDOWSCESTYLE_P_H -#include <QtWidgets/qwindowsstyle.h> +#include <private/qwindowsstyle_p.h> QT_BEGIN_HEADER diff --git a/src/widgets/styles/qwindowscestyle_p_p.h b/src/widgets/styles/qwindowscestyle_p_p.h index 5f1e33016d..51128faff3 100644 --- a/src/widgets/styles/qwindowscestyle_p_p.h +++ b/src/widgets/styles/qwindowscestyle_p_p.h @@ -43,7 +43,7 @@ #define QWINDOWSCESTYLE_P_P_H #include "qwindowscestyle_p.h" -#include <private/qwindowsstyle_p.h> +#include <private/qwindowsstyle_p_p.h> // // W A R N I N G diff --git a/src/widgets/styles/qwindowsmobilestyle_p.h b/src/widgets/styles/qwindowsmobilestyle_p.h index d29389dd6e..eeca466f05 100644 --- a/src/widgets/styles/qwindowsmobilestyle_p.h +++ b/src/widgets/styles/qwindowsmobilestyle_p.h @@ -42,7 +42,7 @@ #ifndef QWINDOWSMOBILESTYLE_P_H #define QWINDOWSMOBILESTYLE_P_H -#include <QtWidgets/qwindowsstyle.h> +#include <private/qwindowsstyle_p.h> QT_BEGIN_HEADER diff --git a/src/widgets/styles/qwindowsmobilestyle_p_p.h b/src/widgets/styles/qwindowsmobilestyle_p_p.h index fd6862d40b..2153c9d2b6 100644 --- a/src/widgets/styles/qwindowsmobilestyle_p_p.h +++ b/src/widgets/styles/qwindowsmobilestyle_p_p.h @@ -54,7 +54,7 @@ // #include "qwindowsmobilestyle_p.h" -#include "qwindowsstyle_p.h" +#include "qwindowsstyle_p_p.h" QT_BEGIN_NAMESPACE diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index d1cd1f6d91..b060d34807 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qwindowsstyle.h" #include "qwindowsstyle_p.h" +#include "qwindowsstyle_p_p.h" #if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN) @@ -200,6 +200,7 @@ bool QWindowsStyle::eventFilter(QObject *o, QEvent *e) \ingroup appearance \inmodule QtWidgets + \internal This style is Qt's default GUI style on Windows. diff --git a/src/widgets/styles/qwindowsstyle_p.h b/src/widgets/styles/qwindowsstyle_p.h index 6d69557edd..542e61cb81 100644 --- a/src/widgets/styles/qwindowsstyle_p.h +++ b/src/widgets/styles/qwindowsstyle_p.h @@ -42,58 +42,67 @@ #ifndef QWINDOWSSTYLE_P_H #define QWINDOWSSTYLE_P_H -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. -// -// We mean it. -// - -#include "qwindowsstyle.h" -#include "qcommonstyle_p.h" - -#ifndef QT_NO_STYLE_WINDOWS -#include <qlist.h> -#include <qhash.h> +#include <QtWidgets/qcommonstyle.h> + +QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -class QTime; -class QWindowsStylePrivate : public QCommonStylePrivate +#if !defined(QT_NO_STYLE_WINDOWS) + +class QWindowsStylePrivate; + +class QWindowsStyle : public QCommonStyle { - Q_DECLARE_PUBLIC(QWindowsStyle) + Q_OBJECT public: - QWindowsStylePrivate(); - bool hasSeenAlt(const QWidget *widget) const; - bool altDown() const { return alt_down; } - bool alt_down; - QList<const QWidget *> seenAlt; - int menuBarTimer; - - QColor inactiveCaptionText; - QColor activeCaptionColor; - QColor activeGradientCaptionColor; - QColor inactiveCaptionColor; - QColor inactiveGradientCaptionColor; - - enum { - windowsItemFrame = 2, // menu item frame width - windowsSepHeight = 9, // separator item height - windowsItemHMargin = 3, // menu item hor text margin - windowsItemVMargin = 2, // menu item ver text margin - windowsArrowHMargin = 6, // arrow horizontal margin - windowsRightBorder = 15, // right border on windows - windowsCheckMarkWidth = 12 // checkmarks width on windows - }; + QWindowsStyle(); + ~QWindowsStyle(); + + void polish(QApplication*); + void unpolish(QApplication*); + + void polish(QWidget*); + void unpolish(QWidget*); + + void polish(QPalette &); + + void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, + const QWidget *w = 0) const; + void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, + const QWidget *w = 0) const; + QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const; + void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, + const QWidget *w = 0) const; + QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, + const QSize &contentsSize, const QWidget *widget = 0) const; + + int pixelMetric(PixelMetric pm, const QStyleOption *option = 0, const QWidget *widget = 0) const; + + int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0, + QStyleHintReturn *returnData = 0) const; + + QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, + const QWidget *widget = 0) const; + + QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0, + const QWidget *widget = 0) const; + +protected: + bool eventFilter(QObject *o, QEvent *e); + QWindowsStyle(QWindowsStylePrivate &dd); + +private: + Q_DISABLE_COPY(QWindowsStyle) + Q_DECLARE_PRIVATE(QWindowsStyle) + void *reserved; }; +#endif // QT_NO_STYLE_WINDOWS + QT_END_NAMESPACE -#endif // QT_NO_STYLE_WINDOWS +QT_END_HEADER -#endif //QWINDOWSSTYLE_P_H +#endif // QWINDOWSSTYLE_P_H diff --git a/src/widgets/styles/qwindowsstyle.h b/src/widgets/styles/qwindowsstyle_p_p.h index 1d9347a72e..99684909e4 100644 --- a/src/widgets/styles/qwindowsstyle.h +++ b/src/widgets/styles/qwindowsstyle_p_p.h @@ -39,70 +39,61 @@ ** ****************************************************************************/ -#ifndef QWINDOWSSTYLE_H -#define QWINDOWSSTYLE_H - -#include <QtWidgets/qcommonstyle.h> - -QT_BEGIN_HEADER +#ifndef QWINDOWSSTYLE_P_P_H +#define QWINDOWSSTYLE_P_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header +// file may change from version to version without notice, or even be removed. +// +// We mean it. +// + +#include "qwindowsstyle_p.h" +#include "qcommonstyle_p.h" + +#ifndef QT_NO_STYLE_WINDOWS +#include <qlist.h> +#include <qhash.h> QT_BEGIN_NAMESPACE +class QTime; -#if !defined(QT_NO_STYLE_WINDOWS) - -class QWindowsStylePrivate; - -class Q_WIDGETS_EXPORT QWindowsStyle : public QCommonStyle +class QWindowsStylePrivate : public QCommonStylePrivate { - Q_OBJECT + Q_DECLARE_PUBLIC(QWindowsStyle) public: - QWindowsStyle(); - ~QWindowsStyle(); - - void polish(QApplication*); - void unpolish(QApplication*); - - void polish(QWidget*); - void unpolish(QWidget*); - - void polish(QPalette &); - - void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, - const QWidget *w = 0) const; - void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, - const QWidget *w = 0) const; - QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget = 0) const; - void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, - const QWidget *w = 0) const; - QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, - const QSize &contentsSize, const QWidget *widget = 0) const; - - int pixelMetric(PixelMetric pm, const QStyleOption *option = 0, const QWidget *widget = 0) const; - - int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0, - QStyleHintReturn *returnData = 0) const; - - QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, - const QWidget *widget = 0) const; - - QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0, - const QWidget *widget = 0) const; - -protected: - bool eventFilter(QObject *o, QEvent *e); - QWindowsStyle(QWindowsStylePrivate &dd); - -private: - Q_DISABLE_COPY(QWindowsStyle) - Q_DECLARE_PRIVATE(QWindowsStyle) - void *reserved; + QWindowsStylePrivate(); + bool hasSeenAlt(const QWidget *widget) const; + bool altDown() const { return alt_down; } + bool alt_down; + QList<const QWidget *> seenAlt; + int menuBarTimer; + + QColor inactiveCaptionText; + QColor activeCaptionColor; + QColor activeGradientCaptionColor; + QColor inactiveCaptionColor; + QColor inactiveGradientCaptionColor; + + enum { + windowsItemFrame = 2, // menu item frame width + windowsSepHeight = 9, // separator item height + windowsItemHMargin = 3, // menu item hor text margin + windowsItemVMargin = 2, // menu item ver text margin + windowsArrowHMargin = 6, // arrow horizontal margin + windowsRightBorder = 15, // right border on windows + windowsCheckMarkWidth = 12 // checkmarks width on windows + }; }; -#endif // QT_NO_STYLE_WINDOWS - QT_END_NAMESPACE -QT_END_HEADER +#endif // QT_NO_STYLE_WINDOWS -#endif // QWINDOWSSTYLE_H +#endif //QWINDOWSSTYLE_P_P_H diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h index 6bd5e58aec..91b6d64163 100644 --- a/src/widgets/styles/qwindowsxpstyle_p_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p_p.h @@ -54,7 +54,7 @@ // #include "qwindowsxpstyle_p.h" -#include "qwindowsstyle_p.h" +#include "qwindowsstyle_p_p.h" #include <qmap.h> #include <qt_windows.h> diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri index 71a4bf1e76..b15eb1fa48 100644 --- a/src/widgets/styles/styles.pri +++ b/src/widgets/styles/styles.pri @@ -66,7 +66,8 @@ contains( styles, mac ) { } contains( styles, windows ) { - HEADERS += styles/qwindowsstyle.h + HEADERS += styles/qwindowsstyle_p.h + HEADERS += styles/qwindowsstyle_p_p.h SOURCES += styles/qwindowsstyle.cpp DEFINES += QT_STYLE_WINDOWS } else { |