![]() |
Qt 6.x
The Qt SDK
|
#include <qquickwindowsxpstyle_p_p.h>
Public Types | |
enum | Theme { ButtonTheme , ComboboxTheme , EditTheme , HeaderTheme , ListViewTheme , MenuTheme , ProgressTheme , RebarTheme , ScrollBarTheme , SpinTheme , TabTheme , TaskDialogTheme , ToolBarTheme , ToolTipTheme , TrackBarTheme , XpTreeViewTheme , WindowTheme , StatusTheme , VistaTreeViewTheme , NThemes } |
![]() | |
enum | { InvalidMetric = -23576 } |
enum | { windowsItemFrame = 2 , windowsSepHeight = 9 , windowsItemHMargin = 3 , windowsItemVMargin = 2 , windowsArrowHMargin = 6 , windowsRightBorder = 15 , windowsCheckMarkWidth = 12 } |
![]() | |
typedef void(* | StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **) |
using | ConnectionDataPointer = QExplicitlySharedDataPointer< ConnectionData > |
Static Public Member Functions | |
static int | pixelMetricFromSystemDp (QStyle::PixelMetric pm, const QStyleOption *option=nullptr) |
static int | fixedPixelMetric (QStyle::PixelMetric pm, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) |
static HWND | winId (const QWindow *window) |
static bool | useXP (bool update=false) |
static QRect | scrollBarGripperBounds (QStyle::State flags, XPThemeData *theme) |
static HTHEME | createTheme (int theme, HWND hwnd) |
static QString | themeName (int theme) |
static bool | hasTheme (int theme) |
static bool | isItemViewDelegateLineEdit (const QWidget *widget) |
static bool | isLineEditBaseColorSet (const QStyleOption *option, const QWidget *widget) |
![]() | |
static int | pixelMetricFromSystemDp (QStyle::PixelMetric pm, const QStyleOption *option=nullptr) |
static int | fixedPixelMetric (QStyle::PixelMetric pm) |
static qreal | devicePixelRatio (const QStyleOption *option=nullptr) |
static qreal | devicePixelRatio (const QWindow *win) |
static qreal | nativeMetricScaleFactor (const QStyleOption *option=nullptr) |
static qreal | nativeMetricScaleFactor (const QWindow *win) |
static bool | isDarkMode () |
![]() | |
static bool | useFullScreenForPopup () |
![]() | |
static bool | removeConnection (Connection *c) |
static QObjectPrivate * | get (QObject *o) |
static const QObjectPrivate * | get (const QObject *o) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiverPrivate, Func2 slot) |
static QMetaObject::Connection | connectImpl (const QObject *sender, int signal_index, const QObject *receiver, void **slot, QtPrivate::QSlotObjectBase *slotObj, int type, const int *types, const QMetaObject *senderMetaObject) |
static QMetaObject::Connection | connect (const QObject *sender, int signal_index, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type) |
static QMetaObject::Connection | connect (const QObject *sender, int signal_index, const QObject *receiver, QtPrivate::QSlotObjectBase *slotObj, Qt::ConnectionType type) |
static bool | disconnect (const QObject *sender, int signal_index, void **slot) |
static bool | disconnect (const QObject *sender, int signal_index, const QObject *receiver, void **slot) |
Definition at line 157 of file qquickwindowsxpstyle_p_p.h.
Definition at line 161 of file qquickwindowsxpstyle_p_p.h.
|
inline |
Definition at line 184 of file qquickwindowsxpstyle_p_p.h.
References init().
|
inline |
Definition at line 187 of file qquickwindowsxpstyle_p_p.h.
References cleanup().
HBITMAP QQC2::QWindowsXPStylePrivate::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 321 of file qquickwindowsxpstyle.cpp.
References Q_UNLIKELY, qDebug, qErrnoWarning(), and qMax().
|
inline |
Definition at line 200 of file qquickwindowsxpstyle_p_p.h.
Referenced by drawBackgroundThruNativeBuffer(), and region().
Definition at line 146 of file qquickwindowsxpstyle.cpp.
References cleanupHandleMap().
Referenced by ~QWindowsXPStylePrivate().
void QQC2::QWindowsXPStylePrivate::cleanupHandleMap | ( | ) |
Definition at line 225 of file qquickwindowsxpstyle.cpp.
Referenced by cleanup().
|
static |
Definition at line 236 of file qquickwindowsxpstyle.cpp.
References NThemes, Q_UNLIKELY, qErrnoWarning(), qPrintable, qWarning, themeName(), QQC2::themeNames, and VistaTreeViewTheme.
Referenced by QQC2::XPThemeData::handle().
bool QQC2::QWindowsXPStylePrivate::drawBackground | ( | XPThemeData & | themeData, |
qreal | correctionFactor = 1 |
||
) |
Main theme drawing function. Determines the correct lowlevel drawing method depending on several factors. Use drawBackgroundThruNativeBuffer() if:
Definition at line 568 of file qquickwindowsxpstyle.cpp.
References QPainter::device(), QPaintDevice::devType(), drawBackgroundThruNativeBuffer(), QPainter::isActive(), QRect::isEmpty(), painter, QQC2::XPThemeData::painter, Q_ASSERT, Q_ASSERT_X, QQC2::XPThemeData::rect, QPainter::restore(), QPainter::save(), QInternal::Widget, and QQC2::XPThemeData::window.
bool QQC2::QWindowsXPStylePrivate::drawBackgroundDirectly | ( | HDC | dc, |
XPThemeData & | 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 646 of file qquickwindowsxpstyle.cpp.
References area(), QRegion::boundingRect(), QPainter::clipRegion(), QPainter::deviceTransform(), deviceTransform(), QQC2::XPThemeData::handle(), QPainter::hasClipping(), QRegion::isEmpty(), QQC2::XPThemeData::mirrorHorizontally, QQC2::XPThemeData::noBorder, QQC2::XPThemeData::noContent, QPainter::paintEngine(), painter, QQC2::XPThemeData::painter, QQC2::XPThemeData::partId, qPrintable, QQC2::qt_hrgn_from_qregion(), QQC2::XPThemeData::rect, QQC2::scaleRect(), QQC2::scaleRegion(), QQC2::XPThemeData::stateId, QPaintEngine::systemClip(), QPointF::toPoint(), QRectF::toRect(), QQC2::XPThemeData::toRECT(), QRegion::translated(), and QRectF::translated().
bool QQC2::QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer | ( | XPThemeData & | 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 (horizonal 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 698 of file qquickwindowsxpstyle.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(), QQC2::XPThemeData::handle(), hasAlpha(), hasAlphaChannel(), QRect::height(), QRectF::height(), QHash< Key, T >::insert(), QPixmapCache::insert(), Qt::IntersectClip, QRegion::isEmpty(), isTransparent(), Qt::KeepAspectRatio, QQC2::MaskAlpha, QImage::mirrored(), QQC2::XPThemeData::mirrorHorizontally, QQC2::XPThemeData::mirrorVertically, QRectF::moveTo(), QQC2::NoAlpha, QQC2::XPThemeData::noBorder, QQC2::XPThemeData::noContent, QString::number(), painter, QQC2::XPThemeData::painter, QQC2::XPThemeData::partId, pix, qFuzzyCompare(), qPrintable, QStringLiteral, QQC2::RealAlpha, rect, QQC2::XPThemeData::rect, region(), QTransform::rotate(), QQC2::XPThemeData::rotate, QQC2::scaleRect(), QQC2::scaleRegion(), QPainter::setClipping(), QPainter::setClipRegion(), QRectF::size(), Qt::SmoothTransformation, QQC2::XPThemeData::stateId, swapAlphaChannel(), QQC2::XPThemeData::theme, themeName(), QPixmap::toImage(), QRectF::topLeft(), QRectF::toRect(), QQC2::XPThemeData::toRECT(), QImage::transformed(), QQC2::UnknownAlpha, QHash< Key, T >::value(), QRect::width(), QRectF::width(), QRect::x(), and QRect::y().
Referenced by drawBackground().
bool QQC2::QWindowsXPStylePrivate::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 occures.
Definition at line 475 of file qquickwindowsxpstyle.cpp.
References qAlpha(), qBlue(), qGreen(), qRed(), and rect.
Referenced by drawBackgroundThruNativeBuffer().
|
static |
bool QQC2::QWindowsXPStylePrivate::hasAlphaChannel | ( | const QRect & | rect | ) |
Returns true
if the native doublebuffer contains pixels with varying alpha value.
Definition at line 446 of file qquickwindowsxpstyle.cpp.
References rect.
Referenced by drawBackgroundThruNativeBuffer().
|
inlinestatic |
Definition at line 224 of file qquickwindowsxpstyle_p_p.h.
References NThemes.
Definition at line 132 of file qquickwindowsxpstyle.cpp.
References NThemes, and useXP().
Referenced by QWindowsXPStylePrivate().
|
static |
|
static |
bool QQC2::QWindowsXPStylePrivate::isTransparent | ( | XPThemeData & | 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 385 of file qquickwindowsxpstyle.cpp.
References QQC2::XPThemeData::handle(), QQC2::XPThemeData::partId, and QQC2::XPThemeData::stateId.
Referenced by drawBackgroundThruNativeBuffer().
|
static |
Definition at line 3011 of file qquickwindowsxpstyle.cpp.
References ButtonTheme, QSizeF::height(), Qt::Horizontal, QQC2::QWindowsStylePrivate::InvalidMetric, QQC2::QStyle::PM_DockWidgetFrameWidth, QQC2::QStyle::PM_ExclusiveIndicatorHeight, QQC2::QStyle::PM_ExclusiveIndicatorWidth, QQC2::QStyle::PM_IndicatorHeight, QQC2::QStyle::PM_IndicatorWidth, QQC2::QStyle::PM_MdiSubWindowFrameWidth, QQC2::QStyle::PM_ProgressBarChunkWidth, QQC2::QStyle::PM_SliderThickness, QQC2::QStyle::PM_TitleBarHeight, QQC2::progressBarOrientation(), ProgressTheme, QQC2::XPThemeData::themeSize(), Qt::Tool, TrackBarTheme, QSizeF::width(), and WindowTheme.
Referenced by QQC2::QWindowsXPStyle::pixelMetric().
QRegion QQC2::QWindowsXPStylePrivate::region | ( | XPThemeData & | themeData | ) |
Returns a QRegion of the region of the part
Definition at line 395 of file qquickwindowsxpstyle.cpp.
References bufferHDC(), ERROR, QQC2::XPThemeData::handle(), i, QQC2::QWindowsStylePrivate::nativeMetricScaleFactor(), QQC2::XPThemeData::partId, rd, rect, QQC2::XPThemeData::rect, region(), QRect::size(), QQC2::XPThemeData::stateId, QRect::topLeft(), QQC2::XPThemeData::toRECT(), and QQC2::XPThemeData::window.
Referenced by drawBackgroundThruNativeBuffer(), and region().
|
static |
Definition at line 2256 of file qquickwindowsxpstyle.cpp.
References QMargins::bottom(), QRect::height(), QMargins::left(), QQC2::XPThemeData::margins(), QQC2::QWindowsStylePrivate::nativeMetricScaleFactor(), QQC2::XPThemeData::partId, QQC2::XPThemeData::rect, QMargins::right(), QQC2::XPThemeData::size(), QQC2::QStyle::State_Horizontal, TMT_SIZINGMARGINS, QMargins::top(), QRect::topLeft(), QRect::width(), and QQC2::XPThemeData::window.
Referenced by QQC2::QWindowsXPStyle::drawComplexControl().
Swaps the alpha values on certain pixels: 0xFF?????? -> 0x00?????? 0x00?????? -> 0xFF?????? Used to determin 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 506 of file qquickwindowsxpstyle.cpp.
References rect.
Referenced by drawBackgroundThruNativeBuffer().
|
static |
Definition at line 254 of file qquickwindowsxpstyle.cpp.
References QString::fromWCharArray(), NThemes, and QQC2::themeNames.
|
static |
Definition at line 120 of file qquickwindowsxpstyle.cpp.
References QCoreApplication::instance(), and QQC2::QWindowsStylePrivate::isDarkMode().
Referenced by QQC2::QWindowsXPStyle::drawComplexControl(), QQC2::QWindowsXPStyle::drawControl(), QQC2::QWindowsXPStyle::drawPrimitive(), QQC2::XPThemeData::handle(), init(), QQC2::XPThemeData::isValid(), QQC2::QWindowsXPStyle::pixelMetric(), QQC2::QWindowsXPStyle::sizeFromContents(), QQC2::QWindowsXPStyle::standardIcon(), QQC2::QWindowsXPStyle::standardPalette(), QQC2::QWindowsXPStyle::standardPixmap(), QQC2::QWindowsXPStyle::styleHint(), QQC2::QWindowsXPStyle::subControlRect(), and QQC2::QWindowsXPStyle::subElementRect().
|
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 300 of file qquickwindowsxpstyle.cpp.
References QGuiApplication::allWindows(), Qt::Desktop, and window().
Referenced by QQC2::XPThemeData::handle().
QIcon QQC2::QWindowsXPStylePrivate::dockClose |
Definition at line 228 of file qquickwindowsxpstyle_p_p.h.
QIcon QQC2::QWindowsXPStylePrivate::dockFloat |
Definition at line 228 of file qquickwindowsxpstyle_p_p.h.
QRgb QQC2::QWindowsXPStylePrivate::groupBoxTextColor = 0 |
Definition at line 217 of file qquickwindowsxpstyle_p_p.h.
QRgb QQC2::QWindowsXPStylePrivate::groupBoxTextColorDisabled = 0 |
Definition at line 218 of file qquickwindowsxpstyle_p_p.h.
bool QQC2::QWindowsXPStylePrivate::hasInitColors = false |
Definition at line 220 of file qquickwindowsxpstyle_p_p.h.
QRgb QQC2::QWindowsXPStylePrivate::sliderTickColor = 0 |
Definition at line 219 of file qquickwindowsxpstyle_p_p.h.