diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-10-27 12:43:42 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-10-27 12:44:57 (GMT) |
commit | d683fd25512dedacdac141222db36209ef65e42d (patch) | |
tree | bf47224d501aba6f0fa1305e7f86f71777e2c677 /tests | |
parent | 0897713a560700f574386499a872f59e3fc4ce7d (diff) | |
download | Qt-d683fd25512dedacdac141222db36209ef65e42d.zip Qt-d683fd25512dedacdac141222db36209ef65e42d.tar.gz Qt-d683fd25512dedacdac141222db36209ef65e42d.tar.bz2 |
Fixed QTreeView not emitting doubleCliked when 1st col is spanned
Task-number: QTBUG-976
Reviewed-by: ogoffart
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qtreeview/tst_qtreeview.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index cbc999f..1429771 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -235,6 +235,7 @@ private slots: void task254234_proxySort(); void task248022_changeSelection(); void task245654_changeModelAndExpandAll(); + void doubleClickedWithSpans(); }; class QtTestModel: public QAbstractItemModel @@ -3544,6 +3545,34 @@ void tst_QTreeView::task245654_changeModelAndExpandAll() } +void tst_QTreeView::doubleClickedWithSpans() +{ + QTreeView view; + QStandardItemModel model(1, 2); + view.setModel(&model); + view.setFirstColumnSpanned(0, QModelIndex(), true); + view.show(); + + QPoint p(10, 10); + QCOMPARE(view.indexAt(p), model.index(0, 0)); + QSignalSpy spy(&view, SIGNAL(doubleClicked(QModelIndex))); + QTest::mousePress(view.viewport(), Qt::LeftButton, 0, p); + QTest::mouseDClick(view.viewport(), Qt::LeftButton, 0, p); + QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, p); + QCOMPARE(spy.count(), 1); + + //let's click on the 2nd column + p.setX(p.x() + view.header()->sectionSize(0)); + QCOMPARE(view.indexAt(p), model.index(0, 0)); + + //end the previous edition + QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, p); + QTest::qWait(100); + QTest::mousePress(view.viewport(), Qt::LeftButton, 0, p); + QTest::mouseDClick(view.viewport(), Qt::LeftButton, 0, p); + QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, p); + QCOMPARE(spy.count(), 2); +} QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" |