From 8f4b6f1cd166986f219e72a584fe19379880c2c5 Mon Sep 17 00:00:00 2001 From: David Faure Date: Wed, 28 Aug 2013 21:09:18 +0200 Subject: item delegates: fix clicking on tristate checkboxes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QCheckBox cycles through the 3 states, but item delegates didn't do that. Change-Id: Iad1e464341033ca357925fe8064f53bb584459f4 Reviewed-by: Thorbjørn Lund Martsum Reviewed-by: Stephen Kelly --- .../itemviews/qitemdelegate/tst_qitemdelegate.cpp | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'tests/auto/widgets/itemviews') diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index 538cc7bb4c..439725b257 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp @@ -1198,6 +1198,57 @@ void tst_QItemDelegate::editorEvent_data() << (int)(Qt::LeftButton) << true << (int)(Qt::Unchecked); + + QTest::newRow("unchecked, tristate, release") + << QRect(0, 0, 20, 20) + << QString("foo") + << (int)(Qt::Unchecked) + << (int)(Qt::ItemIsEditable + |Qt::ItemIsSelectable + |Qt::ItemIsUserCheckable + |Qt::ItemIsTristate + |Qt::ItemIsEnabled + |Qt::ItemIsDragEnabled + |Qt::ItemIsDropEnabled) + << true + << (int)(QEvent::MouseButtonRelease) + << (int)(Qt::LeftButton) + << true + << (int)(Qt::PartiallyChecked); + + QTest::newRow("partially checked, tristate, release") + << QRect(0, 0, 20, 20) + << QString("foo") + << (int)(Qt::PartiallyChecked) + << (int)(Qt::ItemIsEditable + |Qt::ItemIsSelectable + |Qt::ItemIsUserCheckable + |Qt::ItemIsTristate + |Qt::ItemIsEnabled + |Qt::ItemIsDragEnabled + |Qt::ItemIsDropEnabled) + << true + << (int)(QEvent::MouseButtonRelease) + << (int)(Qt::LeftButton) + << true + << (int)(Qt::Checked); + + QTest::newRow("checked, tristate, release") + << QRect(0, 0, 20, 20) + << QString("foo") + << (int)(Qt::Checked) + << (int)(Qt::ItemIsEditable + |Qt::ItemIsSelectable + |Qt::ItemIsUserCheckable + |Qt::ItemIsTristate + |Qt::ItemIsEnabled + |Qt::ItemIsDragEnabled + |Qt::ItemIsDropEnabled) + << true + << (int)(QEvent::MouseButtonRelease) + << (int)(Qt::LeftButton) + << true + << (int)(Qt::Unchecked); } void tst_QItemDelegate::editorEvent() -- cgit v1.2.3