Fixed mouse double click events not bubbling up to parent widgets.
The bug was caused by changesb371f3f943
and3bb9024952
, which removed the event forwarding that QWidget::mouseDoubleClickEvent() used to do without making sure to call ignore() on the event like QWidget::mousePressEvent() does. Task-number: QTBUG-29680 Change-Id: I98af8052ad3dd1dea15d07a710aa9212ef5e4a68 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
parent
ff86f6ba4c
commit
17e8286fef
@ -8413,7 +8413,7 @@ void QWidget::mouseReleaseEvent(QMouseEvent *event)
|
||||
|
||||
void QWidget::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
|
@ -411,6 +411,7 @@ private slots:
|
||||
void destroyedSignal();
|
||||
|
||||
void keyboardModifiers();
|
||||
void mouseDoubleClickBubbling_QTBUG29680();
|
||||
|
||||
private:
|
||||
bool ensureScreenSize(int width, int height);
|
||||
@ -10047,5 +10048,30 @@ void tst_QWidget::keyboardModifiers()
|
||||
QCOMPARE(int(w->m_appModifiers), int(Qt::ControlModifier));
|
||||
}
|
||||
|
||||
class DClickWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
DClickWidget() : triggered(false) {}
|
||||
void mouseDoubleClickEvent(QMouseEvent *)
|
||||
{
|
||||
triggered = true;
|
||||
}
|
||||
bool triggered;
|
||||
};
|
||||
|
||||
void tst_QWidget::mouseDoubleClickBubbling_QTBUG29680()
|
||||
{
|
||||
DClickWidget parent;
|
||||
QWidget child(&parent);
|
||||
parent.resize(200, 200);
|
||||
child.resize(200, 200);
|
||||
parent.show();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&parent));
|
||||
|
||||
QTest::mouseDClick(&child, Qt::LeftButton);
|
||||
|
||||
QTRY_VERIFY(parent.triggered);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QWidget)
|
||||
#include "tst_qwidget.moc"
|
||||
|
Loading…
Reference in New Issue
Block a user