summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidget.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-06-07 19:10:53 +0200
committerLiang Qi <liang.qi@qt.io>2018-06-07 19:10:53 +0200
commit096e37910d93f9c52976600e985c615ea36fe291 (patch)
tree713d020f4a04f03d8ca6e111055e7eebe85953a8 /src/widgets/kernel/qwidget.cpp
parent88eda007a3b5046999dd0b287634765efcd8934d (diff)
parenta14a943f9ac3d1e85514d7fb6688c84e624ac850 (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: .qmake.conf src/corelib/kernel/qeventdispatcher_cf.mm src/gui/kernel/qguiapplication_p.h src/gui/kernel/qwindowsysteminterface.cpp src/gui/kernel/qwindowsysteminterface.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnswindowdelegate.mm src/plugins/platforms/ios/qioseventdispatcher.mm src/plugins/platforms/windows/qwindowsdrag.h src/plugins/platforms/windows/qwindowsinternalmimedata.h src/plugins/platforms/windows/qwindowsmime.cpp src/plugins/platforms/winrt/qwinrtscreen.cpp Change-Id: Ic817f265c2386e83839d2bb9ef7419cb29705246
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
-rw-r--r--src/widgets/kernel/qwidget.cpp40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 6b3fad6b5f..95d3da1ed4 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1322,7 +1322,7 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)
<< "Alien?" << !testAttribute(Qt::WA_NativeWindow);
#endif
-#if 0 /* Used to be included in Qt4 for Q_WS_WIN */ && !defined(QT_NO_DRAGANDDROP)
+#if 0 /* Used to be included in Qt4 for Q_WS_WIN */ && QT_CONFIG(draganddrop)
// Unregister the dropsite (if already registered) before we
// re-create the widget with a native window.
if (testAttribute(Qt::WA_WState_Created) && !internalWinId() && testAttribute(Qt::WA_NativeWindow)
@@ -5574,21 +5574,23 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
if (renderToTexture) {
// This widget renders into a texture which is composed later. We just need to
// punch a hole in the backingstore, so the texture will be visible.
- if (!q->testAttribute(Qt::WA_AlwaysStackOnTop)) {
- beginBackingStorePainting();
- if (backingStore) {
- QPainter p(q);
- p.setCompositionMode(QPainter::CompositionMode_Source);
- p.fillRect(q->rect(), Qt::transparent);
- } else {
- QImage img = grabFramebuffer();
- QPainter p(q);
- // We are not drawing to a backingstore: fall back to QImage
- p.drawImage(q->rect(), img);
- skipPaintEvent = true;
- }
- endBackingStorePainting();
+ beginBackingStorePainting();
+ if (!q->testAttribute(Qt::WA_AlwaysStackOnTop) && backingStore) {
+ QPainter p(q);
+ p.setCompositionMode(QPainter::CompositionMode_Source);
+ p.fillRect(q->rect(), Qt::transparent);
+ } else if (!backingStore) {
+ // We are not drawing to a backingstore: fall back to QImage
+ QImage img = grabFramebuffer();
+ // grabFramebuffer() always sets the format to RGB32
+ // regardless of whether it is transparent or not.
+ if (img.format() == QImage::Format_RGB32)
+ img.reinterpretAsFormat(QImage::Format_ARGB32_Premultiplied);
+ QPainter p(q);
+ p.drawImage(q->rect(), img);
+ skipPaintEvent = true;
}
+ endBackingStorePainting();
if (renderToTextureReallyDirty)
renderToTextureReallyDirty = 0;
else
@@ -9075,7 +9077,7 @@ bool QWidget::event(QEvent *event)
break;
#endif // QT_NO_CONTEXTMENU
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
case QEvent::Drop:
dropEvent((QDropEvent*) event);
break;
@@ -9957,7 +9959,7 @@ void QWidget::setInputMethodHints(Qt::InputMethodHints hints)
}
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
/*!
\fn void QWidget::dragEnterEvent(QDragEnterEvent *event)
@@ -10026,7 +10028,7 @@ void QWidget::dropEvent(QDropEvent *)
{
}
-#endif // QT_NO_DRAGANDDROP
+#endif // QT_CONFIG(draganddrop)
/*!
\fn void QWidget::showEvent(QShowEvent *event)
@@ -11175,7 +11177,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
switch (attribute) {
-#ifndef QT_NO_DRAGANDDROP
+#if QT_CONFIG(draganddrop)
case Qt::WA_AcceptDrops: {
if (on && !testAttribute(Qt::WA_DropSiteRegistered))
setAttribute(Qt::WA_DropSiteRegistered, true);