Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QWindowsVistaStylePrivate Class Reference

#include <qwindowsvistastyle_p_p.h>

+ Inheritance diagram for QWindowsVistaStylePrivate:
+ Collaboration diagram for QWindowsVistaStylePrivate:

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 QBackingStorebackingStoreForWidget (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
 

Detailed Description

Definition at line 84 of file qwindowsvistastyle_p_p.h.

Member Enumeration Documentation

◆ Theme

Enumerator
ButtonTheme 
ComboboxTheme 
EditTheme 
HeaderTheme 
ListViewTheme 
MenuTheme 
ProgressTheme 
RebarTheme 
ScrollBarTheme 
SpinTheme 
TabTheme 
TaskDialogTheme 
ToolBarTheme 
ToolTipTheme 
TrackBarTheme 
WindowTheme 
StatusTheme 
VistaTreeViewTheme 
NThemes 

Definition at line 89 of file qwindowsvistastyle_p_p.h.

Constructor & Destructor Documentation

◆ QWindowsVistaStylePrivate()

QWindowsVistaStylePrivate::QWindowsVistaStylePrivate ( )
inline

Definition at line 111 of file qwindowsvistastyle_p_p.h.

References init().

+ Here is the call graph for this function:

◆ ~QWindowsVistaStylePrivate()

QWindowsVistaStylePrivate::~QWindowsVistaStylePrivate ( )
inline

Definition at line 114 of file qwindowsvistastyle_p_p.h.

References cleanup().

+ Here is the call graph for this function:

Member Function Documentation

◆ animationTime()

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().

+ Here is the call graph for this function:

◆ backingStoreForWidget()

QBackingStore * QWindowsVistaStylePrivate::backingStoreForWidget ( const QWidget widget)
static

Definition at line 357 of file qwindowsvistastyle.cpp.

References QWidget::backingStore(), QWidget::nativeParentWidget(), and widget.

Referenced by drawBackground(), and hdcForWidgetBackingStore().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buffer()

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().

+ Here is the call graph for this function:

◆ bufferHDC()

HDC QWindowsVistaStylePrivate::bufferHDC ( )
inline

Definition at line 134 of file qwindowsvistastyle_p_p.h.

Referenced by drawBackgroundThruNativeBuffer(), and region().

+ Here is the caller graph for this function:

◆ cleanup()

void QWindowsVistaStylePrivate::cleanup ( bool  force = false)

Definition at line 193 of file qwindowsvistastyle.cpp.

References cleanupHandleMap().

Referenced by ~QWindowsVistaStylePrivate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cleanupHandleMap()

void QWindowsVistaStylePrivate::cleanupHandleMap ( )

Definition at line 327 of file qwindowsvistastyle.cpp.

Referenced by cleanup().

+ Here is the caller graph for this function:

◆ createTheme()

HTHEME QWindowsVistaStylePrivate::createTheme ( int  theme,
HWND  hwnd 
)
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawBackground()

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().

+ Here is the call graph for this function:

◆ drawBackgroundDirectly()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawBackgroundThruNativeBuffer()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fixAlphaChannel()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fixedPixelMetric()

int QWindowsVistaStylePrivate::fixedPixelMetric ( QStyle::PixelMetric  pm)
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().

+ Here is the caller graph for this function:

◆ hasAlphaChannel()

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().

+ Here is the caller graph for this function:

◆ hasTheme()

static bool QWindowsVistaStylePrivate::hasTheme ( int  theme)
inlinestatic

Definition at line 119 of file qwindowsvistastyle_p_p.h.

References NThemes.

◆ hdcForWidgetBackingStore()

HDC QWindowsVistaStylePrivate::hdcForWidgetBackingStore ( const QWidget widget)
static

Definition at line 367 of file qwindowsvistastyle.cpp.

References backingStoreForWidget(), QPlatformNativeInterface::nativeResourceForBackingStore(), QGuiApplication::platformNativeInterface(), QByteArrayLiteral, and widget.

Referenced by drawBackground(), and QWindowsThemeData::mask().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ init()

void QWindowsVistaStylePrivate::init ( bool  force = false)

Definition at line 179 of file qwindowsvistastyle.cpp.

References NThemes, and useVista().

Referenced by QWindowsVistaStylePrivate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isItemViewDelegateLineEdit()

bool QWindowsVistaStylePrivate::isItemViewDelegateLineEdit ( const QWidget widget)
static

Definition at line 383 of file qwindowsvistastyle.cpp.

References QObject::inherits(), QWidget::isWindow(), QWidget::parentWidget(), and widget.

Referenced by QWindowsVistaStyle::drawPrimitive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isLineEditBaseColorSet()

bool QWindowsVistaStylePrivate::isLineEditBaseColorSet ( const QStyleOption option,
const QWidget widget 
)
static

Definition at line 397 of file qwindowsvistastyle.cpp.

References QPalette::Base, QWidget::parentWidget(), and widget.

Referenced by QWindowsVistaStyle::drawPrimitive(), and supportsStateTransition().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isTransparent()

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

  • Alpha transparency
  • Masked transparency

Definition at line 504 of file qwindowsvistastyle.cpp.

References QWindowsThemeData::handle(), QWindowsThemeData::partId, and QWindowsThemeData::stateId.

Referenced by drawBackgroundThruNativeBuffer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ openThemeForPrimaryScreenDpi()

HTHEME QWindowsVistaStylePrivate::openThemeForPrimaryScreenDpi ( HWND  hwnd,
const wchar_t *  name 
)
static

Definition at line 226 of file qwindowsvistastyle.cpp.

References QGuiApplication::primaryScreen, and qRound().

Referenced by createTheme().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pixelMetricFromSystemDp()

int QWindowsVistaStylePrivate::pixelMetricFromSystemDp ( QStyle::PixelMetric  pm,
const QStyleOption option = nullptr,
const QWidget widget = nullptr 
)
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ region()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ swapAlphaChannel()

bool QWindowsVistaStylePrivate::swapAlphaChannel ( const QRect rect,
bool  allPixels = false 
)

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().

+ Here is the caller graph for this function:

◆ themeName()

QString QWindowsVistaStylePrivate::themeName ( int  theme)
static

Definition at line 377 of file qwindowsvistastyle.cpp.

References QString::fromWCharArray(), NThemes, and themeNames.

+ Here is the call graph for this function:

◆ transitionsEnabled()

bool QWindowsVistaStylePrivate::transitionsEnabled ( ) const

Definition at line 215 of file qwindowsvistastyle.cpp.

◆ useVista()

bool QWindowsVistaStylePrivate::useVista ( bool  update = false)
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ winId()

HWND QWindowsVistaStylePrivate::winId ( const QWidget widget)
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ dockClose

QIcon QWindowsVistaStylePrivate::dockClose

Definition at line 152 of file qwindowsvistastyle_p_p.h.

◆ dockFloat

QIcon QWindowsVistaStylePrivate::dockFloat

Definition at line 152 of file qwindowsvistastyle_p_p.h.

◆ groupBoxTextColor

QRgb QWindowsVistaStylePrivate::groupBoxTextColor = 0

Definition at line 148 of file qwindowsvistastyle_p_p.h.

◆ groupBoxTextColorDisabled

QRgb QWindowsVistaStylePrivate::groupBoxTextColorDisabled = 0

Definition at line 149 of file qwindowsvistastyle_p_p.h.

◆ hasInitColors

bool QWindowsVistaStylePrivate::hasInitColors = false

Definition at line 151 of file qwindowsvistastyle_p_p.h.

◆ sliderTickColor

QRgb QWindowsVistaStylePrivate::sliderTickColor = 0

Definition at line 150 of file qwindowsvistastyle_p_p.h.


The documentation for this class was generated from the following files: