Fix QPixmap::grabWidget() on Windows.
Do not draw on the backingstore DC when drawing to a pixmap. Access the paintdevice for checking via the QPaintEngine since QPainter returns the clipdevice, which is a widget. Fix warning about accessing handle of 0-window in the test. Task-number: QTBUG-24183 Change-Id: Ie91ea6ab9d09528c7ec1d35633f9a0ee667719b1 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
This commit is contained in:
parent
d505886dd6
commit
099029a342
@ -339,7 +339,7 @@ HWND QWindowsXPStylePrivate::winId(const QWidget *widget)
|
|||||||
|
|
||||||
// Find top level with native window (there might be dialogs that do not have one).
|
// Find top level with native window (there might be dialogs that do not have one).
|
||||||
foreach (const QWidget *toplevel, QApplication::topLevelWidgets())
|
foreach (const QWidget *toplevel, QApplication::topLevelWidgets())
|
||||||
if (toplevel->windowHandle())
|
if (toplevel->windowHandle() && toplevel->windowHandle()->handle())
|
||||||
if (const HWND topLevelHwnd = QApplicationPrivate::getHWNDForWidget(toplevel))
|
if (const HWND topLevelHwnd = QApplicationPrivate::getHWNDForWidget(toplevel))
|
||||||
return topLevelHwnd;
|
return topLevelHwnd;
|
||||||
|
|
||||||
@ -698,7 +698,10 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Draw on backing store DC only for real widgets.
|
// Draw on backing store DC only for real widgets.
|
||||||
const bool useFallback = !themeData.widget || painter->device()->devType() != QInternal::Widget
|
// Access paintDevice via engine since the painter may
|
||||||
|
// return the clip device which can still be a widget device in case of grabWidget().
|
||||||
|
const bool useFallback = !themeData.widget
|
||||||
|
|| painter->paintEngine()->paintDevice()->devType() != QInternal::Widget
|
||||||
|| painter->opacity() != 1.0 || themeData.rotate
|
|| painter->opacity() != 1.0 || themeData.rotate
|
||||||
|| complexXForm || themeData.mirrorVertically
|
|| complexXForm || themeData.mirrorVertically
|
||||||
|| (themeData.mirrorHorizontally && pDrawThemeBackgroundEx == 0)
|
|| (themeData.mirrorHorizontally && pDrawThemeBackgroundEx == 0)
|
||||||
|
@ -10,5 +10,3 @@ SOURCES += tst_qpixmap.cpp
|
|||||||
|
|
||||||
RESOURCES += qpixmap.qrc
|
RESOURCES += qpixmap.qrc
|
||||||
TESTDATA += convertFromImage/* convertFromToHICON/* loadFromData/* images/*
|
TESTDATA += convertFromImage/* convertFromToHICON/* loadFromData/* images/*
|
||||||
|
|
||||||
win32:CONFIG += insignificant_test # QTBUG-24183
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user