diff options
author | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-05-11 14:29:17 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2015-05-12 08:58:47 +0000 |
commit | 1adedb7baad717bd6f41796ccc717ba93e2f3738 (patch) | |
tree | 326cfb20a097c7641e898338b1b7ee905eb12965 /examples/widgets | |
parent | 62f24f04bf2b3a254faccc35fc7f673ef76a9345 (diff) | |
download | qtbase-1adedb7baad717bd6f41796ccc717ba93e2f3738.tar.gz |
Make the windowcontainer example more robust
The QWindow tends to get mouse releases on Windows when
maximizing the window for example. This is likely a problem
in the platform, but the example should be improved too to
be more robust and ignore such unwanted events.
Task-number: QTBUG-42842
Change-Id: Iecf916a2f753ed1b37d644721ee212ca7c728c49
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'examples/widgets')
-rw-r--r-- | examples/widgets/windowcontainer/windowcontainer.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/examples/widgets/windowcontainer/windowcontainer.cpp b/examples/widgets/windowcontainer/windowcontainer.cpp index 022b6dafc4..a38a10e6f6 100644 --- a/examples/widgets/windowcontainer/windowcontainer.cpp +++ b/examples/widgets/windowcontainer/windowcontainer.cpp @@ -92,10 +92,12 @@ public: } void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE { - m_mouseDown = true; - m_polygon.clear(); - m_polygon.append(e->pos()); - renderLater(); + if (!m_mouseDown) { + m_mouseDown = true; + m_polygon.clear(); + m_polygon.append(e->pos()); + renderLater(); + } } void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE { @@ -106,9 +108,11 @@ public: } void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE { - m_mouseDown = false; - m_polygon.append(e->pos()); - renderLater(); + if (m_mouseDown) { + m_mouseDown = false; + m_polygon.append(e->pos()); + renderLater(); + } } void focusInEvent(QFocusEvent *) Q_DECL_OVERRIDE { |