Fixed mouse double click events not bubbling up to parent widgets.

The bug was caused by changes b371f3f943
and 3bb9024952, 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:
Samuel Rødal 2013-02-14 08:35:23 +01:00 committed by The Qt Project
parent ff86f6ba4c
commit 17e8286fef
2 changed files with 27 additions and 1 deletions

View File

@ -8413,7 +8413,7 @@ void QWidget::mouseReleaseEvent(QMouseEvent *event)
void QWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
Q_UNUSED(event);
event->ignore();
}
#ifndef QT_NO_WHEELEVENT

View File

@ -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"