diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-01-16 01:22:45 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-01-16 01:22:45 +0100 |
commit | 7075e291998612a3c0a530bb37a515dd07739e28 (patch) | |
tree | 4e1992498d82ee3f6f92fd6d42754c92928dd581 /src/plugins/platforms/windows | |
parent | 1161a8a62907796ea45b1877bec31e66aeef77f6 (diff) | |
parent | 3d9a40038f01bc2a3df0027a9be04e7fa3ce3850 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/widgets/styles/qstyleanimation.cpp
Change-Id: Iae570895be6544de80f9c1ec309d1a08c59daff8
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsbackingstore.cpp | 16 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 17 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.h | 1 |
3 files changed, 25 insertions, 9 deletions
diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index b7937b4d84..5d3822d2cd 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -45,6 +45,7 @@ #include "qwindowscontext.h" #include <QtGui/QWindow> +#include <QtGui/QPainter> #include <QtCore/QDebug> @@ -147,8 +148,10 @@ void QWindowsBackingStore::resize(const QSize &size, const QRegion ®ion) nsp << " from: " << m_image->image().size(); } #endif - m_image.reset(new QWindowsNativeImage(size.width(), size.height(), - QWindowsNativeImage::systemFormat())); + QImage::Format format = QWindowsNativeImage::systemFormat(); + if (format == QImage::Format_RGB32 && rasterWindow()->window()->format().hasAlpha()) + format = QImage::Format_ARGB32; + m_image.reset(new QWindowsNativeImage(size.width(), size.height(), format)); } } @@ -168,9 +171,16 @@ bool QWindowsBackingStore::scroll(const QRegion &area, int dx, int dy) void QWindowsBackingStore::beginPaint(const QRegion ®ion) { - Q_UNUSED(region); if (QWindowsContext::verboseBackingStore > 1) qDebug() << __FUNCTION__; + + if (m_image->image().hasAlphaChannel()) { + QPainter p(&m_image->image()); + p.setCompositionMode(QPainter::CompositionMode_Source); + const QColor blank = Qt::transparent; + foreach (const QRect &r, region.rects()) + p.fillRect(r, blank); + } } QWindowsWindow *QWindowsBackingStore::rasterWindow() const diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 50fd7a0792..23ebd6bd9e 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -267,7 +267,7 @@ static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, qreal level) struct WindowCreationData { typedef QWindowsWindow::WindowData WindowData; - enum Flags { ForceChild = 0x1 }; + enum Flags { ForceChild = 0x1, ForceTopLevel = 0x2 }; WindowCreationData() : parentHandle(0), type(Qt::Widget), style(0), exStyle(0), topLevel(false), popup(false), dialog(false), desktop(false), @@ -319,7 +319,13 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag parentHandle = (HWND)prop.value<WId>(); } - topLevel = ((creationFlags & ForceChild) || embedded) ? false : w->isTopLevel(); + if (creationFlags & ForceChild) { + topLevel = false; + } else if (creationFlags & ForceTopLevel) { + topLevel = true; + } else { + topLevel = w->isTopLevel(); + } if (topLevel && flags == 1) { flags |= Qt::WindowTitleHint|Qt::WindowSystemMenuHint|Qt::WindowMinimizeButtonHint @@ -1022,10 +1028,9 @@ void QWindowsWindow::setParent_sys(const QPlatformWindow *parent) const // WS_CHILD/WS_POPUP must be manually set/cleared in addition // to dialog frames, etc (see SetParent() ) if the top level state changes. - if (wasTopLevel != isTopLevel) { - const unsigned flags = isTopLevel ? unsigned(0) : unsigned(WindowCreationData::ForceChild); - setWindowFlags_sys(window()->flags(), flags); - } + // Force toplevel state as QWindow::isTopLevel cannot be relied upon here. + if (wasTopLevel != isTopLevel) + setWindowFlags_sys(window()->flags(), unsigned(isTopLevel ? WindowCreationData::ForceTopLevel : WindowCreationData::ForceChild)); } } diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 4e82938cf4..f98855d84d 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -158,6 +158,7 @@ public: virtual void setVisible(bool visible); bool isVisible() const; + virtual bool isExposed() const { return m_windowState != Qt::WindowMinimized && isVisible(); } virtual bool isActive() const; virtual bool isEmbedded(const QPlatformWindow *parentWindow) const; virtual QPoint mapToGlobal(const QPoint &pos) const; |