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>.
|
#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 | 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) |
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 1022 of file qwindowsvistastyle.cpp.
References QTime::currentTime().
|
static |
Definition at line 304 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 386 of file qwindowsvistastyle.cpp.
References Q_UNLIKELY, qDebug, qErrnoWarning(), and qMax().
|
inline |
Definition at line 133 of file qwindowsvistastyle_p_p.h.
Referenced by drawBackgroundThruNativeBuffer(), and region().
Definition at line 179 of file qwindowsvistastyle.cpp.
References cleanupHandleMap().
Referenced by ~QWindowsVistaStylePrivate().
void QWindowsVistaStylePrivate::cleanupHandleMap | ( | ) |
Definition at line 291 of file qwindowsvistastyle.cpp.
References QWindowsThemeCache::clearAllThemeCaches().
Referenced by cleanup().
|
static |
Definition at line 297 of file qwindowsvistastyle.cpp.
References QWindowsThemeCache::createTheme(), 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 611 of file qwindowsvistastyle.cpp.
References backingStoreForWidget(), ComplexTransform, QPainter::device(), QPaintDevice::devicePixelRatio(), QPainter::deviceTransform(), QPaintDevice::devType(), drawBackgroundDirectly(), drawBackgroundThruNativeBuffer(), hdcForWidgetBackingStore(), QInternal::Image, QPainter::isActive(), isFullyOpaque(), QPainter::opacity(), QPaintEngine::paintDevice(), QPainter::paintEngine(), painter, Q_ASSERT_X, qFuzzyCompare(), QPainter::restore(), QPainter::save(), Qt::WA_TranslucentBackground, QInternal::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 670 of file qwindowsvistastyle.cpp.
References area(), QPainter::clipRegion(), QPainter::deviceTransform(), deviceTransform(), QPainter::hasClipping(), QPainter::paintEngine(), painter, qPrintable, qt_hrgn_from_qregion(), scaleRect(), scaleRegion(), and QPaintEngine::systemClip().
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 722 of file qwindowsvistastyle.cpp.
References area(), bufferHDC(), QPainter::clipRegion(), QImage::copy(), ThemeMapData::dataValid, QPainter::drawImage(), QPainter::drawPixmap(), QPixmapCache::find(), fixAlphaChannel(), QImage::Format_ARGB32_Premultiplied, QImage::Format_RGB32, QPixmap::fromImage(), hasAlpha(), hasAlphaChannel(), QRect::height(), QRectF::height(), QHash< Key, T >::insert(), QPixmapCache::insert(), Qt::IntersectClip, isTransparent(), Qt::KeepAspectRatio, MaskAlpha, QRectF::moveTo(), NoAlpha, QString::number(), painter, pix, qFuzzyCompare(), qPrintable, QStringLiteral, RealAlpha, rect, region(), QTransform::rotate(), scaleRect(), scaleRegion(), QPainter::setClipping(), QPainter::setClipRegion(), QRectF::size(), Qt::SmoothTransformation, swapAlphaChannel(), themeName(), QRectF::topLeft(), QRectF::toRect(), 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 540 of file qwindowsvistastyle.cpp.
References qAlpha(), qBlue(), qGreen(), qRed(), and rect.
Referenced by drawBackgroundThruNativeBuffer().
|
static |
Definition at line 241 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 511 of file qwindowsvistastyle.cpp.
References rect.
Referenced by drawBackgroundThruNativeBuffer().
|
static |
Definition at line 314 of file qwindowsvistastyle.cpp.
References backingStoreForWidget(), QPlatformNativeInterface::nativeResourceForBackingStore(), QGuiApplication::platformNativeInterface(), QByteArrayLiteral, and widget.
Referenced by drawBackground(), and QWindowsThemeData::mask().
Definition at line 166 of file qwindowsvistastyle.cpp.
References useVista().
Referenced by QWindowsVistaStylePrivate().
|
static |
Definition at line 329 of file qwindowsvistastyle.cpp.
References QObject::inherits(), QWidget::parentWidget(), and widget.
Referenced by QWindowsVistaStyle::drawPrimitive().
|
static |
Definition at line 343 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 450 of file qwindowsvistastyle.cpp.
Referenced by drawBackgroundThruNativeBuffer().
|
static |
Definition at line 212 of file qwindowsvistastyle.cpp.
References ButtonTheme, 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(), TrackBarTheme, widget, and WindowTheme.
Referenced by QWindowsVistaStyle::pixelMetric().
QRegion QWindowsVistaStylePrivate::region | ( | QWindowsThemeData & | themeData | ) |
Returns a QRegion of the region of the part
Definition at line 460 of file qwindowsvistastyle.cpp.
References bufferHDC(), ERROR, i, rd, rect, region(), and QRect::setCoords().
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 571 of file qwindowsvistastyle.cpp.
References rect.
Referenced by drawBackgroundThruNativeBuffer().
|
static |
Definition at line 324 of file qwindowsvistastyle.cpp.
References QWindowsThemeCache::themeName().
bool QWindowsVistaStylePrivate::transitionsEnabled | ( | ) | const |
Definition at line 201 of file qwindowsvistastyle.cpp.
|
static |
Definition at line 156 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 364 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 151 of file qwindowsvistastyle_p_p.h.
QIcon QWindowsVistaStylePrivate::dockFloat |
Definition at line 151 of file qwindowsvistastyle_p_p.h.
QRgb QWindowsVistaStylePrivate::groupBoxTextColor = 0 |
Definition at line 147 of file qwindowsvistastyle_p_p.h.
Referenced by QWindowsVistaStyle::styleHint().
QRgb QWindowsVistaStylePrivate::groupBoxTextColorDisabled = 0 |
Definition at line 148 of file qwindowsvistastyle_p_p.h.
bool QWindowsVistaStylePrivate::hasInitColors = false |
Definition at line 150 of file qwindowsvistastyle_p_p.h.
QRgb QWindowsVistaStylePrivate::sliderTickColor = 0 |
Definition at line 149 of file qwindowsvistastyle_p_p.h.