![]() |
Qt 6.x
The Qt SDK
|
#include <qwindowsvistastyle_p_p.h>
Public Types | |
enum | Theme { ButtonTheme , ComboboxTheme , EditTheme , HeaderTheme , ListViewTheme , MenuTheme , ProgressTheme , RebarTheme , ScrollBarTheme , SpinTheme , TabTheme , TaskDialogTheme , ToolBarTheme , ToolTipTheme , TrackBarTheme , WindowTheme , StatusTheme , VistaTreeViewTheme , NThemes } |
Public Member Functions | |
QWindowsVistaStylePrivate () | |
~QWindowsVistaStylePrivate () | |
void | init (bool force=false) |
void | cleanup (bool force=false) |
void | cleanupHandleMap () |
HBITMAP | buffer (int w=0, int h=0) |
HDC | bufferHDC () |
bool | isTransparent (QWindowsThemeData &QWindowsThemeData) |
QRegion | region (QWindowsThemeData &QWindowsThemeData) |
bool | drawBackground (QWindowsThemeData &QWindowsThemeData, qreal correctionFactor=1) |
bool | drawBackgroundThruNativeBuffer (QWindowsThemeData &QWindowsThemeData, qreal aditionalDevicePixelRatio, qreal correctionFactor) |
bool | drawBackgroundDirectly (HDC dc, QWindowsThemeData &QWindowsThemeData, qreal aditionalDevicePixelRatio) |
bool | hasAlphaChannel (const QRect &rect) |
bool | fixAlphaChannel (const QRect &rect) |
bool | swapAlphaChannel (const QRect &rect, bool allPixels=false) |
QTime | animationTime () const |
bool | transitionsEnabled () const |
Static Public Member Functions | |
static HTHEME | createTheme (int theme, HWND hwnd) |
static QString | themeName (int theme) |
static bool | hasTheme (int theme) |
static bool | isItemViewDelegateLineEdit (const QWidget *widget) |
static int | pixelMetricFromSystemDp (QStyle::PixelMetric pm, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) |
static int | fixedPixelMetric (QStyle::PixelMetric pm) |
static bool | isLineEditBaseColorSet (const QStyleOption *option, const QWidget *widget) |
static HWND | winId (const QWidget *widget) |
static bool | useVista (bool update=false) |
static QBackingStore * | backingStoreForWidget (const QWidget *widget) |
static HDC | hdcForWidgetBackingStore (const QWidget *widget) |
static HTHEME | openThemeForPrimaryScreenDpi (HWND hwnd, const wchar_t *name) |
Public Attributes | |
QRgb | groupBoxTextColor = 0 |
QRgb | groupBoxTextColorDisabled = 0 |
QRgb | sliderTickColor = 0 |
bool | hasInitColors = false |
QIcon | dockFloat |
QIcon | dockClose |
Definition at line 84 of file qwindowsvistastyle_p_p.h.
Definition at line 89 of file qwindowsvistastyle_p_p.h.
|
inline |
Definition at line 111 of file qwindowsvistastyle_p_p.h.
References init().
|
inline |
Definition at line 114 of file qwindowsvistastyle_p_p.h.
References cleanup().
QTime QWindowsVistaStylePrivate::animationTime | ( | ) | const |
Animations are started at a frame that is based on the current time, which makes it impossible to run baseline tests with this style. Allow overriding through a dynamic property.
Definition at line 1076 of file qwindowsvistastyle.cpp.
References QTime::currentTime().
|
static |
Definition at line 357 of file qwindowsvistastyle.cpp.
References QWidget::backingStore(), QWidget::nativeParentWidget(), and widget.
Referenced by drawBackground(), and hdcForWidgetBackingStore().
HBITMAP QWindowsVistaStylePrivate::buffer | ( | int | w = 0 , |
int | h = 0 |
||
) |
Returns a native buffer (DIB section) of at least the size of ( x , y ). The buffer has a 32 bit depth, to not lose the alpha values on proper alpha-pixmaps.
Definition at line 440 of file qwindowsvistastyle.cpp.
References Q_UNLIKELY, qDebug, qErrnoWarning(), and qMax().
|
inline |
Definition at line 134 of file qwindowsvistastyle_p_p.h.
Referenced by drawBackgroundThruNativeBuffer(), and region().
Definition at line 193 of file qwindowsvistastyle.cpp.
References cleanupHandleMap().
Referenced by ~QWindowsVistaStylePrivate().
void QWindowsVistaStylePrivate::cleanupHandleMap | ( | ) |
Definition at line 327 of file qwindowsvistastyle.cpp.
Referenced by cleanup().
|
static |
Definition at line 338 of file qwindowsvistastyle.cpp.
References NThemes, openThemeForPrimaryScreenDpi(), Q_UNLIKELY, qErrnoWarning(), qPrintable, qWarning, themeName(), themeNames, and VistaTreeViewTheme.
Referenced by QWindowsThemeData::handle().
bool QWindowsVistaStylePrivate::drawBackground | ( | QWindowsThemeData & | themeData, |
qreal | correctionFactor = 1 |
||
) |
Main theme drawing function. Determines the correct lowlevel drawing method depending on several factors. Use drawBackgroundThruNativeBuffer() if:
Definition at line 665 of file qwindowsvistastyle.cpp.
References backingStoreForWidget(), ComplexTransform, QPainter::device(), QPaintDevice::devicePixelRatio(), QPainter::deviceTransform(), QPaintDevice::devType(), drawBackgroundDirectly(), drawBackgroundThruNativeBuffer(), hdcForWidgetBackingStore(), QInternal::Image, QWindowsThemeData::invertPixels, QPainter::isActive(), QRect::isEmpty(), isFullyOpaque(), QWindowsThemeData::mirrorVertically, QPainter::opacity(), QPaintEngine::paintDevice(), QPainter::paintEngine(), QWindowsThemeData::painter, painter, Q_ASSERT_X, qFuzzyCompare(), QWindowsThemeData::rect, QPainter::restore(), QWindowsThemeData::rotate, QPainter::save(), Qt::WA_TranslucentBackground, QInternal::Widget, QWindowsThemeData::widget, and window().
bool QWindowsVistaStylePrivate::drawBackgroundDirectly | ( | HDC | dc, |
QWindowsThemeData & | themeData, | ||
qreal | additionalDevicePixelRatio | ||
) |
This function draws the theme parts directly to the paintengines HDC. Do not use this if you need to perform other transformations on the resulting data.
Definition at line 724 of file qwindowsvistastyle.cpp.
References area(), QRegion::boundingRect(), QPainter::clipRegion(), QPainter::deviceTransform(), deviceTransform(), QWindowsThemeData::handle(), QPainter::hasClipping(), QRegion::isEmpty(), QWindowsThemeData::mirrorHorizontally, QWindowsThemeData::noBorder, QWindowsThemeData::noContent, QPainter::paintEngine(), QWindowsThemeData::painter, painter, QWindowsThemeData::partId, qPrintable, qt_hrgn_from_qregion(), QWindowsThemeData::rect, scaleRect(), scaleRegion(), QWindowsThemeData::stateId, QPaintEngine::systemClip(), QPointF::toPoint(), QRectF::toRect(), QWindowsThemeData::toRECT(), QRegion::translated(), and QRectF::translated().
Referenced by drawBackground().
bool QWindowsVistaStylePrivate::drawBackgroundThruNativeBuffer | ( | QWindowsThemeData & | themeData, |
qreal | additionalDevicePixelRatio, | ||
qreal | correctionFactor | ||
) |
This function uses a secondary Native doublebuffer for painting parts. It should only be used when the painteengine doesn't provide a proper HDC for direct painting (e.g. when doing a grabWidget(), painting to other pixmaps etc), or when special transformations are needed (e.g. flips (horizontal mirroring only, vertical are handled by the theme engine).
correctionFactor is an additional factor used to scale up controls that are too small on High DPI screens, as has been observed for WP_MDICLOSEBUTTON, WP_MDIRESTOREBUTTON, WP_MDIMINBUTTON (QTBUG-75927).
Definition at line 776 of file qwindowsvistastyle.cpp.
References QString::append(), area(), bufferHDC(), QPainter::clipRegion(), QImage::copy(), QPixmap::copy(), ThemeMapData::dataValid, QPainter::drawImage(), QPainter::drawPixmap(), QPixmapCache::find(), fixAlphaChannel(), QImage::Format_ARGB32_Premultiplied, QImage::Format_RGB32, QPixmap::fromImage(), QWindowsThemeData::handle(), hasAlpha(), hasAlphaChannel(), QRect::height(), QRectF::height(), QHash< Key, T >::insert(), QPixmapCache::insert(), Qt::IntersectClip, QWindowsThemeData::invertPixels, QRegion::isEmpty(), isTransparent(), Qt::KeepAspectRatio, MaskAlpha, QImage::mirrored(), QWindowsThemeData::mirrorHorizontally, QWindowsThemeData::mirrorVertically, QRectF::moveTo(), NoAlpha, QWindowsThemeData::noBorder, QWindowsThemeData::noContent, QString::number(), QWindowsThemeData::painter, painter, QWindowsThemeData::partId, pix, qFuzzyCompare(), qPrintable, QStringLiteral, RealAlpha, QWindowsThemeData::rect, rect, region(), QTransform::rotate(), QWindowsThemeData::rotate, scaleRect(), scaleRegion(), QPainter::setClipping(), QPainter::setClipRegion(), QRectF::size(), Qt::SmoothTransformation, QWindowsThemeData::stateId, swapAlphaChannel(), QWindowsThemeData::theme, themeName(), QPixmap::toImage(), QRectF::topLeft(), QRectF::toRect(), QWindowsThemeData::toRECT(), QImage::transformed(), UnknownAlpha, QHash< Key, T >::value(), QRect::width(), QRectF::width(), QRect::x(), and QRect::y().
Referenced by drawBackground().
bool QWindowsVistaStylePrivate::fixAlphaChannel | ( | const QRect & | rect | ) |
When the theme engine paints both a true alpha pixmap and a glyph into our buffer, the glyph might not contain a proper alpha value. The rule of thumb for premultiplied pixmaps is that the color values of a pixel can never be higher than the alpha values, so we use this to our advantage here, and fix all instances where this occurs.
Definition at line 594 of file qwindowsvistastyle.cpp.
References qAlpha(), qBlue(), qGreen(), qRed(), and rect.
Referenced by drawBackgroundThruNativeBuffer().
|
static |
Definition at line 277 of file qwindowsvistastyle.cpp.
References QStyle::PM_DockWidgetTitleBarButtonMargin, QStyle::PM_MenuHMargin, QStyle::PM_MenuPanelWidth, QStyle::PM_MenuVMargin, and QStyle::PM_ScrollBarSliderMin.
Referenced by QWindowsVistaStyle::pixelMetric().
bool QWindowsVistaStylePrivate::hasAlphaChannel | ( | const QRect & | rect | ) |
Returns true
if the native doublebuffer contains pixels with varying alpha value.
Definition at line 565 of file qwindowsvistastyle.cpp.
References rect.
Referenced by drawBackgroundThruNativeBuffer().
|
inlinestatic |
Definition at line 119 of file qwindowsvistastyle_p_p.h.
References NThemes.
|
static |
Definition at line 367 of file qwindowsvistastyle.cpp.
References backingStoreForWidget(), QPlatformNativeInterface::nativeResourceForBackingStore(), QGuiApplication::platformNativeInterface(), QByteArrayLiteral, and widget.
Referenced by drawBackground(), and QWindowsThemeData::mask().
Definition at line 179 of file qwindowsvistastyle.cpp.
References NThemes, and useVista().
Referenced by QWindowsVistaStylePrivate().
|
static |
Definition at line 383 of file qwindowsvistastyle.cpp.
References QObject::inherits(), QWidget::isWindow(), QWidget::parentWidget(), and widget.
Referenced by QWindowsVistaStyle::drawPrimitive().
|
static |
Definition at line 397 of file qwindowsvistastyle.cpp.
References QPalette::Base, QWidget::parentWidget(), and widget.
Referenced by QWindowsVistaStyle::drawPrimitive(), and supportsStateTransition().
bool QWindowsVistaStylePrivate::isTransparent | ( | QWindowsThemeData & | themeData | ) |
Returns true
if the part contains any transparency at all. This does not indicate what kind of transparency we're dealing with. It can be
Definition at line 504 of file qwindowsvistastyle.cpp.
References QWindowsThemeData::handle(), QWindowsThemeData::partId, and QWindowsThemeData::stateId.
Referenced by drawBackgroundThruNativeBuffer().
|
static |
Definition at line 226 of file qwindowsvistastyle.cpp.
References QGuiApplication::primaryScreen, and qRound().
Referenced by createTheme().
|
static |
Definition at line 245 of file qwindowsvistastyle.cpp.
References ButtonTheme, QSizeF::height(), Qt::Horizontal, QStyle::PM_DockWidgetFrameWidth, QStyle::PM_ExclusiveIndicatorHeight, QStyle::PM_ExclusiveIndicatorWidth, QStyle::PM_IndicatorHeight, QStyle::PM_IndicatorWidth, QStyle::PM_MdiSubWindowFrameWidth, QStyle::PM_ProgressBarChunkWidth, QStyle::PM_SliderThickness, QStyle::PM_TitleBarHeight, progressBarOrientation(), ProgressTheme, QWindowsThemeData::themeSize(), Qt::Tool, TrackBarTheme, widget, QSizeF::width(), WindowTheme, and QWidget::windowType().
Referenced by QWindowsVistaStyle::pixelMetric().
QRegion QWindowsVistaStylePrivate::region | ( | QWindowsThemeData & | themeData | ) |
Returns a QRegion of the region of the part
Definition at line 514 of file qwindowsvistastyle.cpp.
References bufferHDC(), ERROR, QWindowsThemeData::handle(), i, QWindowsThemeData::partId, rd, QWindowsThemeData::rect, rect, region(), QRect::size(), QWindowsThemeData::stateId, QRect::topLeft(), QWindowsThemeData::toRECT(), and QWindowsThemeData::widget.
Referenced by drawBackgroundThruNativeBuffer(), and region().
Swaps the alpha values on certain pixels: 0xFF?????? -> 0x00?????? 0x00?????? -> 0xFF?????? Used to determine the mask of a non-alpha transparent pixmap in the native doublebuffer, and swap the alphas so we may paint the image as a Premultiplied QImage with drawImage(), and obtain the mask transparency.
Definition at line 625 of file qwindowsvistastyle.cpp.
References rect.
Referenced by drawBackgroundThruNativeBuffer().
|
static |
Definition at line 377 of file qwindowsvistastyle.cpp.
References QString::fromWCharArray(), NThemes, and themeNames.
bool QWindowsVistaStylePrivate::transitionsEnabled | ( | ) | const |
Definition at line 215 of file qwindowsvistastyle.cpp.
|
static |
Definition at line 169 of file qwindowsvistastyle.cpp.
References QCoreApplication::instance().
Referenced by QWindowsVistaStyle::drawComplexControl(), QWindowsVistaStyle::drawControl(), QWindowsVistaStyle::drawPrimitive(), QWindowsThemeData::handle(), init(), QWindowsVistaAnimation::isUpdateNeeded(), QWindowsThemeData::isValid(), QWindowsVistaStyle::pixelMetric(), QWindowsVistaStyle::polish(), QWindowsVistaStyle::sizeFromContents(), QWindowsVistaStyle::standardIcon(), QWindowsVistaStyle::standardPixmap(), QWindowsVistaStyle::subControlRect(), QWindowsVistaStyle::subElementRect(), and QWindowsVistaStyle::unpolish().
|
static |
This function will always return a valid window handle, and might create a limbo widget to do so. We often need a window handle to for example open theme data, so this function ensures that we get one.
Definition at line 418 of file qwindowsvistastyle.cpp.
References QGuiApplication::allWindows(), Qt::Desktop, widget, and window().
Referenced by QWindowsThemeData::handle(), QWindowsVistaStyle::polish(), and QWindowsVistaStyle::subElementRect().
QIcon QWindowsVistaStylePrivate::dockClose |
Definition at line 152 of file qwindowsvistastyle_p_p.h.
QIcon QWindowsVistaStylePrivate::dockFloat |
Definition at line 152 of file qwindowsvistastyle_p_p.h.
QRgb QWindowsVistaStylePrivate::groupBoxTextColor = 0 |
Definition at line 148 of file qwindowsvistastyle_p_p.h.
QRgb QWindowsVistaStylePrivate::groupBoxTextColorDisabled = 0 |
Definition at line 149 of file qwindowsvistastyle_p_p.h.
bool QWindowsVistaStylePrivate::hasInitColors = false |
Definition at line 151 of file qwindowsvistastyle_p_p.h.
QRgb QWindowsVistaStylePrivate::sliderTickColor = 0 |
Definition at line 150 of file qwindowsvistastyle_p_p.h.