summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-05-26 14:28:19 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-06 06:30:44 +0200
commita1c5198387fdb7db44a02bb94c56187874e67304 (patch)
tree93cc199de1e7619a843ccf0d9abb72350c162df4 /src/widgets
parentc3e416296a1026d7ba99cf209f5e0720ff5050b1 (diff)
Suppress move/resize events if they are the result of call to move()/resize().
QWidget::resize() or QWidget::move() set the new size/position values and send events. The spontaneous events generated by the platform should be ignored in that case. Task-number: QTBUG-30744 Task-number: QTBUG-38768 Task-number: QTBUG-32590 Change-Id: I9c0ae38842ed76a8a88ca64fdc9bbe106b2766b7 Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index fc328e7af0..35a526e77d 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -591,16 +591,24 @@ void QWidgetWindow::updateNormalGeometry()
void QWidgetWindow::handleMoveEvent(QMoveEvent *event)
{
+ // If the widget's position already matches that of the event, this is a
+ // result of call to QWidget::move(), which already sends an event.
+ const bool spontaneous = m_widget->geometry().topLeft() != event->pos();
updateGeometry();
- QGuiApplication::sendSpontaneousEvent(m_widget, event);
+ if (spontaneous)
+ QGuiApplication::sendSpontaneousEvent(m_widget, event);
}
void QWidgetWindow::handleResizeEvent(QResizeEvent *event)
{
QSize oldSize = m_widget->data->crect.size();
+ // If the widget's size already matches that of the event, this is a
+ // result of call to QWidget::resize(), which already sends an event.
+ const bool spontaneous = oldSize != event->size();
updateGeometry();
- QGuiApplication::sendSpontaneousEvent(m_widget, event);
+ if (spontaneous)
+ QGuiApplication::sendSpontaneousEvent(m_widget, event);
if (m_widget->d_func()->paintOnScreen()) {
QRegion updateRegion(geometry());