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>
This commit is contained in:
parent
2bda681eb6
commit
cd31c06590
@ -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
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
#ifndef QWINDOWSCESTYLE_P_H
|
||||
#define QWINDOWSCESTYLE_P_H
|
||||
|
||||
#include <QtWidgets/qwindowsstyle.h>
|
||||
#include <private/qwindowsstyle_p.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
|
@ -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
|
||||
|
@ -42,7 +42,7 @@
|
||||
#ifndef QWINDOWSMOBILESTYLE_P_H
|
||||
#define QWINDOWSMOBILESTYLE_P_H
|
||||
|
||||
#include <QtWidgets/qwindowsstyle.h>
|
||||
#include <private/qwindowsstyle_p.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
||||
//
|
||||
|
||||
#include "qwindowsmobilestyle_p.h"
|
||||
#include "qwindowsstyle_p.h"
|
||||
#include "qwindowsstyle_p_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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 <QtWidgets/qcommonstyle.h>
|
||||
|
||||
#include "qwindowsstyle.h"
|
||||
#include "qcommonstyle_p.h"
|
||||
|
||||
#ifndef QT_NO_STYLE_WINDOWS
|
||||
#include <qlist.h>
|
||||
#include <qhash.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;
|
||||
QWindowsStyle();
|
||||
~QWindowsStyle();
|
||||
|
||||
QColor inactiveCaptionText;
|
||||
QColor activeCaptionColor;
|
||||
QColor activeGradientCaptionColor;
|
||||
QColor inactiveCaptionColor;
|
||||
QColor inactiveGradientCaptionColor;
|
||||
void polish(QApplication*);
|
||||
void unpolish(QApplication*);
|
||||
|
||||
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
|
||||
};
|
||||
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;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_STYLE_WINDOWS
|
||||
|
||||
#endif //QWINDOWSSTYLE_P_H
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QWINDOWSSTYLE_P_H
|
||||
|
@ -39,70 +39,61 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QWINDOWSSTYLE_H
|
||||
#define QWINDOWSSTYLE_H
|
||||
#ifndef QWINDOWSSTYLE_P_P_H
|
||||
#define QWINDOWSSTYLE_P_P_H
|
||||
|
||||
#include <QtWidgets/qcommonstyle.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.
|
||||
//
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
#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();
|
||||
QWindowsStylePrivate();
|
||||
bool hasSeenAlt(const QWidget *widget) const;
|
||||
bool altDown() const { return alt_down; }
|
||||
bool alt_down;
|
||||
QList<const QWidget *> seenAlt;
|
||||
int menuBarTimer;
|
||||
|
||||
void polish(QApplication*);
|
||||
void unpolish(QApplication*);
|
||||
QColor inactiveCaptionText;
|
||||
QColor activeCaptionColor;
|
||||
QColor activeGradientCaptionColor;
|
||||
QColor inactiveCaptionColor;
|
||||
QColor inactiveGradientCaptionColor;
|
||||
|
||||
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;
|
||||
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
|
@ -54,7 +54,7 @@
|
||||
//
|
||||
|
||||
#include "qwindowsxpstyle_p.h"
|
||||
#include "qwindowsstyle_p.h"
|
||||
#include "qwindowsstyle_p_p.h"
|
||||
#include <qmap.h>
|
||||
#include <qt_windows.h>
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user