diff options
Diffstat (limited to 'src/widgets/kernel/qwidgetwindow.cpp')
-rw-r--r-- | src/widgets/kernel/qwidgetwindow.cpp | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 87baaa13de..6b03ad0b6c 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** @@ -10,9 +10,9 @@ ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -23,8 +23,8 @@ ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ @@ -63,7 +63,7 @@ class QWidgetWindowPrivate : public QWindowPrivate { Q_DECLARE_PUBLIC(QWidgetWindow) public: - QWindow *eventReceiver() { + QWindow *eventReceiver() Q_DECL_OVERRIDE { Q_Q(QWidgetWindow); QWindow *w = q; while (w->parent() && qobject_cast<QWidgetWindow *>(w) && qobject_cast<QWidgetWindow *>(w->parent())) { @@ -72,7 +72,7 @@ public: return w; } - void clearFocusObject() + void clearFocusObject() Q_DECL_OVERRIDE { Q_Q(QWidgetWindow); QWidget *widget = q->widget(); @@ -292,11 +292,21 @@ bool QWidgetWindow::event(QEvent *event) case QEvent::WindowBlocked: qt_button_down = 0; break; + + case QEvent::UpdateRequest: + // This is not the same as an UpdateRequest for a QWidget. That just + // syncs the backing store while here we also must mark as dirty. + m_widget->repaint(); + return true; + default: break; } - return m_widget->event(event) || QWindow::event(event); + if (m_widget->event(event) && event->type() != QEvent::Timer) + return true; + + return QWindow::event(event); } QPointer<QWidget> qt_last_mouse_receiver = 0; @@ -440,6 +450,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) QGuiApplicationPrivate::setMouseEventSource(&e, QGuiApplicationPrivate::mouseEventSource(event)); e.setTimestamp(event->timestamp()); QApplicationPrivate::sendMouseEvent(receiver, &e, alien, m_widget, &qt_button_down, qt_last_mouse_receiver); + qt_last_mouse_receiver = receiver; } else { // close disabled popups when a mouse button is pressed or released switch (event->type()) { @@ -634,7 +645,8 @@ void QWidgetWindow::handleScreenChange() sendScreenChangeRecursively(m_widget); // Invalidate the backing store buffer and repaint immediately. - repaintWindow(); + if (screen()) + repaintWindow(); } void QWidgetWindow::repaintWindow() @@ -711,7 +723,7 @@ void QWidgetWindow::handleWheelEvent(QWheelEvent *event) QPoint mapped = widget->mapFrom(m_widget, event->pos()); - QWheelEvent translated(mapped, event->globalPos(), event->pixelDelta(), event->angleDelta(), event->delta(), event->orientation(), event->buttons(), event->modifiers(), event->phase()); + QWheelEvent translated(mapped, event->globalPos(), event->pixelDelta(), event->angleDelta(), event->delta(), event->orientation(), event->buttons(), event->modifiers(), event->phase(), event->source()); QGuiApplication::sendSpontaneousEvent(widget, &translated); } |