Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwindowsvistastyle_p_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QWINDOWSVISTASTYLE_P_P_H
5#define QWINDOWSVISTASTYLE_P_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header
13// file may change from version to version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtWidgets/private/qtwidgetsglobal_p.h>
20#include "qwindowsthemedata_p.h"
21#include <private/qpaintengine_raster_p.h>
22#include <qpaintengine.h>
23#include <qwidget.h>
24#include <qapplication.h>
25#include <qpixmapcache.h>
26#include <qstyleoption.h>
27#include <QtWidgets/private/qwindowsstyle_p_p.h>
28#include <qmap.h>
29
30#if QT_CONFIG(pushbutton)
31#include <qpushbutton.h>
32#endif
33#include <qradiobutton.h>
34#if QT_CONFIG(lineedit)
35#include <qlineedit.h>
36#endif
37#include <qgroupbox.h>
38#if QT_CONFIG(toolbutton)
39#include <qtoolbutton.h>
40#endif
41#if QT_CONFIG(spinbox)
42#include <qspinbox.h>
43#endif
44#if QT_CONFIG(toolbar)
45#include <qtoolbar.h>
46#endif
47#if QT_CONFIG(combobox)
48#include <qcombobox.h>
49#endif
50#if QT_CONFIG(scrollbar)
51#include <qscrollbar.h>
52#endif
53#if QT_CONFIG(progressbar)
54#include <qprogressbar.h>
55#endif
56#if QT_CONFIG(dockwidget)
57#include <qdockwidget.h>
58#endif
59#if QT_CONFIG(listview)
60#include <qlistview.h>
61#endif
62#if QT_CONFIG(treeview)
63#include <qtreeview.h>
64#endif
65#include <qtextedit.h>
66#include <qmessagebox.h>
67#if QT_CONFIG(dialogbuttonbox)
68#include <qdialogbuttonbox.h>
69#endif
70#include <qinputdialog.h>
71#if QT_CONFIG(tableview)
72#include <qtableview.h>
73#endif
74#include <qdatetime.h>
75#if QT_CONFIG(commandlinkbutton)
76#include <qcommandlinkbutton.h>
77#endif
78#include <qlabel.h>
79#include <qheaderview.h>
80#include <uxtheme.h>
81
83
84class QWindowsVistaStylePrivate : public QWindowsStylePrivate
85{
86 Q_DECLARE_PUBLIC(QWindowsVistaStyle)
87
88public:
110
113
116
117 static HTHEME createTheme(int theme, HWND hwnd);
118 static QString themeName(int theme);
119 static bool isItemViewDelegateLineEdit(const QWidget *widget);
120 static int pixelMetricFromSystemDp(QStyle::PixelMetric pm, const QStyleOption *option = nullptr, const QWidget *widget = nullptr);
122 static bool isLineEditBaseColorSet(const QStyleOption *option, const QWidget *widget);
123 static HWND winId(const QWidget *widget);
124 static bool useVista(bool update = false);
126 static HDC hdcForWidgetBackingStore(const QWidget *widget);
127
128 void init(bool force = false);
129 void cleanup(bool force = false);
130 void cleanupHandleMap();
131
132 HBITMAP buffer(int w = 0, int h = 0);
134 { return bufferDC; }
135
138
139 bool drawBackground(QWindowsThemeData &QWindowsThemeData, qreal correctionFactor = 1);
140 bool drawBackgroundThruNativeBuffer(QWindowsThemeData &QWindowsThemeData, qreal aditionalDevicePixelRatio, qreal correctionFactor);
141 bool drawBackgroundDirectly(HDC dc, QWindowsThemeData &QWindowsThemeData, qreal aditionalDevicePixelRatio);
142
143 bool hasAlphaChannel(const QRect &rect);
144 bool fixAlphaChannel(const QRect &rect);
145 bool swapAlphaChannel(const QRect &rect, bool allPixels = false);
146
150 bool hasInitColors = false;
152
153 QTime animationTime() const;
154 bool transitionsEnabled() const;
155
156private:
157 static bool initVistaTreeViewTheming();
158 static void cleanupVistaTreeViewTheming();
159
160 static QBasicAtomicInt ref;
161 static bool useVistaTheme;
162
163 QHash<ThemeMapKey, ThemeMapData> alphaCache;
164 HDC bufferDC = nullptr;
165 HBITMAP bufferBitmap = nullptr;
166 HBITMAP nullBitmap = nullptr;
167 uchar *bufferPixels = nullptr;
168 int bufferW = 0;
169 int bufferH = 0;
170
171 static HWND m_vistaTreeViewHelper;
172};
173
175
176#endif // QWINDOWSVISTASTYLE_P_P_H
The QBackingStore class provides a drawing area for QWindow.
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
\inmodule QtCore\reentrant
Definition qrect.h:30
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
The QStyleOption class stores the parameters used by QStyle functions.
PixelMetric
This enum describes the various available pixel metrics.
Definition qstyle.h:413
\inmodule QtCore \reentrant
Definition qdatetime.h:215
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
static int fixedPixelMetric(QStyle::PixelMetric pm)
static HDC hdcForWidgetBackingStore(const QWidget *widget)
static QBackingStore * backingStoreForWidget(const QWidget *widget)
bool swapAlphaChannel(const QRect &rect, bool allPixels=false)
bool drawBackgroundThruNativeBuffer(QWindowsThemeData &QWindowsThemeData, qreal aditionalDevicePixelRatio, qreal correctionFactor)
static HWND winId(const QWidget *widget)
void init(bool force=false)
static bool isLineEditBaseColorSet(const QStyleOption *option, const QWidget *widget)
bool drawBackgroundDirectly(HDC dc, QWindowsThemeData &QWindowsThemeData, qreal aditionalDevicePixelRatio)
static bool isItemViewDelegateLineEdit(const QWidget *widget)
static bool useVista(bool update=false)
static HTHEME createTheme(int theme, HWND hwnd)
bool fixAlphaChannel(const QRect &rect)
void cleanup(bool force=false)
bool isTransparent(QWindowsThemeData &QWindowsThemeData)
bool hasAlphaChannel(const QRect &rect)
QRegion region(QWindowsThemeData &QWindowsThemeData)
bool drawBackground(QWindowsThemeData &QWindowsThemeData, qreal correctionFactor=1)
static int pixelMetricFromSystemDp(QStyle::PixelMetric pm, const QStyleOption *option=nullptr, const QWidget *widget=nullptr)
The QWindowsVistaStyle class provides a look and feel suitable for applications on Microsoft Windows ...
QOpenGLWidget * widget
[1]
rect
[4]
Combined button and popup list for selecting options.
static QString themeName()
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint buffer
GLint ref
GLfloat GLfloat GLfloat GLfloat h
GLuint GLenum option
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
Definition qrgb.h:13
unsigned char uchar
Definition qtypes.h:32
double qreal
Definition qtypes.h:187