diff options
Diffstat (limited to 'src/plugins/styles/windowsvista/qwindowsxpstyle.cpp')
-rw-r--r-- | src/plugins/styles/windowsvista/qwindowsxpstyle.cpp | 85 |
1 files changed, 39 insertions, 46 deletions
diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp index 4c982c14f4..cf344c8f88 100644 --- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp @@ -54,7 +54,6 @@ #include <private/qapplication_p.h> #include <qpa/qplatformnativeinterface.h> -#include <qdesktopwidget.h> #if QT_CONFIG(toolbutton) #include <qtoolbutton.h> #endif @@ -186,7 +185,6 @@ HRGN XPThemeData::mask(QWidget *widget) // QWindowsXPStylePrivate ------------------------------------------------------------------------- // Static initializations -QPixmap *QWindowsXPStylePrivate::tabbody = 0; HWND QWindowsXPStylePrivate::m_vistaTreeViewHelper = 0; HTHEME QWindowsXPStylePrivate::m_themes[NThemes]; bool QWindowsXPStylePrivate::use_xp = false; @@ -266,8 +264,6 @@ void QWindowsXPStylePrivate::cleanup(bool force) use_xp = false; cleanupHandleMap(); - delete tabbody; - tabbody = 0; } /* In order to obtain the correct VistaTreeViewTheme (arrows for PE_IndicatorBranch), @@ -404,41 +400,16 @@ HWND QWindowsXPStylePrivate::winId(const QWidget *widget) return hwnd; // Find top level with native window (there might be dialogs that do not have one). - const auto topLevels = QApplication::topLevelWidgets(); - for (const QWidget *toplevel : topLevels) { - if (toplevel->windowHandle() && toplevel->windowHandle()->handle()) - if (const HWND topLevelHwnd = QApplicationPrivate::getHWNDForWidget(toplevel)) - return topLevelHwnd; + const auto allWindows = QGuiApplication::allWindows(); + for (const QWindow *window : allWindows) { + if (window->isTopLevel() && window->type() != Qt::Desktop && window->handle() != nullptr) + return reinterpret_cast<HWND>(window->winId()); } return GetDesktopWindow(); } /*! \internal - Returns the pointer to a tab widgets body pixmap, scaled to the - height of the screen. This way the theme engine doesn't need to - scale the body for every time we ask for it. (Speed optimization) -*/ -const QPixmap *QWindowsXPStylePrivate::tabBody(QWidget *widget) -{ - if (!tabbody) { - XPThemeData theme(0, 0, QWindowsXPStylePrivate::TabTheme, TABP_BODY); - const QSize size = (theme.size() * QWindowsStylePrivate::nativeMetricScaleFactor(widget)).toSize(); - - tabbody = new QPixmap(size.width(), QApplication::desktop()->screenGeometry().height()); - QPainter painter(tabbody); - theme.rect = QRect(QPoint(0, 0), size); - drawBackground(theme); - // We fill with the last line of the themedata, that - // way we don't get a tiled pixmap inside big tabs - QPixmap temp(size.width(), 1); - painter.drawPixmap(0, 0, temp, 0, size.height() - 1, -1, -1); - painter.drawTiledPixmap(0, size.height(), size.width(), tabbody->height() - size.height(), temp); - } - return tabbody; -} - -/*! \internal Returns a native buffer (DIB section) of at least the size of ( \a x , \a y ). The buffer has a 32 bit depth, to not lose the alpha values on proper alpha-pixmaps. @@ -564,16 +535,6 @@ QRegion QWindowsXPStylePrivate::region(XPThemeData &themeData) } /*! \internal - Sets the parts region on a window. -*/ -void QWindowsXPStylePrivate::setTransparency(QWidget *widget, XPThemeData &themeData) -{ - HRGN hrgn = themeData.mask(widget); - if (hrgn && widget) - SetWindowRgn(winId(widget), hrgn, true); -} - -/*! \internal Returns \c true if the native doublebuffer contains pixels with varying alpha value. */ @@ -760,10 +721,8 @@ static QRegion scaleRegion(const QRegion ®ion, qreal factor) { if (region.isEmpty() || qFuzzyCompare(factor, qreal(1))) return region; - if (region.rectCount() == 1) - return QRegion(scaleRect(QRectF(region.boundingRect()), factor).toRect()); QRegion result; - foreach (const QRect &rect, region.rects()) + for (const QRect &rect : region) result += QRectF(QPointF(rect.topLeft()) * factor, QSizeF(rect.size() * factor)).toRect(); return result; } @@ -3963,6 +3922,40 @@ QWindowsXPStyle::QWindowsXPStyle(QWindowsXPStylePrivate &dd) : QWindowsStyle(dd) { } +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug d, const XPThemeData &t) +{ + QDebugStateSaver saver(d); + d.nospace(); + d << "XPThemeData(" << t.widget << ", theme=#" << t.theme << ", " << t.htheme + << ", partId=" << t.partId << ", stateId=" << t.stateId << ", rect=" << t.rect + << ", mirrorHorizontally=" << t.mirrorHorizontally << ", mirrorVertically=" + << t.mirrorVertically << ", noBorder=" << t.noBorder << ", noContent=" << t.noContent + << ", rotate=" << t.rotate << ')'; + return d; +} + +QDebug operator<<(QDebug d, const ThemeMapKey &k) +{ + QDebugStateSaver saver(d); + d.nospace(); + d << "ThemeMapKey(theme=#" << k.theme + << ", partId=" << k.partId << ", stateId=" << k.stateId + << ", noBorder=" << k.noBorder << ", noContent=" << k.noContent << ')'; + return d; +} + +QDebug operator<<(QDebug d, const ThemeMapData &td) +{ + QDebugStateSaver saver(d); + d.nospace(); + d << "ThemeMapData(alphaType=" << td.alphaType + << ", dataValid=" << td.dataValid << ", partIsTransparent=" << td.partIsTransparent + << ", hasAlphaChannel=" << td.hasAlphaChannel << ", wasAlphaSwapped=" << td.wasAlphaSwapped + << ", hadInvalidAlpha=" << td.hadInvalidAlpha << ')'; + return d; +} +#endif // QT_NO_DEBUG_STREAM // Debugging code ---------------------------------------------------------------------[ START ]--- // The code for this point on is not compiled by default, but only used as assisting |