summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2013-08-26 10:49:48 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-14 18:23:25 +0100
commitd9c34e9cdd24937a3c487d0f525a8b8b38ee1ad5 (patch)
tree84172b9043b140fe4a3a69a1806eb7b9ebb4da8a /src/widgets
parent6d858a0fdb896d2c4f9f6411f691f0648c084cd7 (diff)
Repaint widgets on screen change.
Add a screenChanged handler slot to QWidgetWindow, which calls markDirty() on the backing store with the BufferInvalid and UpdateNow flags set. Update CocoaBackingStore to create a new buffer on window devicePixelRatio change. Use the QCocoaWindow::devicePixelRatio() implementation instead of a duplicate implementation in the backing store. The plan is to replace this implementation with one based on QUpdateWindowRequestEvent for Qt 5.4 Change-Id: I8e521c53df4ac90815613e730fe821996334721f Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp14
-rw-r--r--src/widgets/kernel/qwidgetwindow_qpa_p.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index e50736d6b8..ef138267bb 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -100,6 +100,7 @@ QWidgetWindow::QWidgetWindow(QWidget *widget)
setSurfaceType(QSurface::RasterGLSurface);
}
connect(m_widget, &QObject::objectNameChanged, this, &QWidgetWindow::updateObjectName);
+ connect(this, SIGNAL(screenChanged(QScreen*)), this, SLOT(repaintWindow()));
}
QWidgetWindow::~QWidgetWindow()
@@ -560,6 +561,19 @@ void QWidgetWindow::updateGeometry()
m_widget->data->fstrut_dirty = false;
}
+// Invalidates the backing store buffer and repaints immediately.
+// ### Qt 5.4: replace with QUpdateWindowRequestEvent.
+void QWidgetWindow::repaintWindow()
+{
+ if (!m_widget->isVisible() || !m_widget->updatesEnabled())
+ return;
+
+ QTLWExtra *tlwExtra = m_widget->window()->d_func()->maybeTopData();
+ if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore)
+ tlwExtra->backingStoreTracker->markDirty(m_widget->rect(), m_widget,
+ QWidgetBackingStore::UpdateNow, QWidgetBackingStore::BufferInvalid);
+}
+
Qt::WindowState effectiveState(Qt::WindowStates state);
// Store normal geometry used for saving application settings.
diff --git a/src/widgets/kernel/qwidgetwindow_qpa_p.h b/src/widgets/kernel/qwidgetwindow_qpa_p.h
index 8d6f14a669..06ba8ea646 100644
--- a/src/widgets/kernel/qwidgetwindow_qpa_p.h
+++ b/src/widgets/kernel/qwidgetwindow_qpa_p.h
@@ -101,6 +101,7 @@ protected:
private slots:
void updateObjectName();
+ void repaintWindow();
private:
void updateGeometry();