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>
This commit is contained in:
parent
62f24f04bf
commit
1adedb7baa
@ -92,10 +92,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE {
|
void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE {
|
||||||
m_mouseDown = true;
|
if (!m_mouseDown) {
|
||||||
m_polygon.clear();
|
m_mouseDown = true;
|
||||||
m_polygon.append(e->pos());
|
m_polygon.clear();
|
||||||
renderLater();
|
m_polygon.append(e->pos());
|
||||||
|
renderLater();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE {
|
void mouseMoveEvent(QMouseEvent *e) Q_DECL_OVERRIDE {
|
||||||
@ -106,9 +108,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE {
|
void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE {
|
||||||
m_mouseDown = false;
|
if (m_mouseDown) {
|
||||||
m_polygon.append(e->pos());
|
m_mouseDown = false;
|
||||||
renderLater();
|
m_polygon.append(e->pos());
|
||||||
|
renderLater();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void focusInEvent(QFocusEvent *) Q_DECL_OVERRIDE {
|
void focusInEvent(QFocusEvent *) Q_DECL_OVERRIDE {
|
||||||
|
Loading…
Reference in New Issue
Block a user