summaryrefslogtreecommitdiff
path: root/tests/auto/controls/data/tst_tableview.qml
diff options
context:
space:
mode:
authorCaroline Chao <caroline.chao@digia.com>2013-05-06 16:16:13 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-07 14:32:56 +0200
commit533b45357246725efacf90b330a718d34a0cf3eb (patch)
tree8513856c771e3236a2afffcc316e665b374a517a /tests/auto/controls/data/tst_tableview.qml
parenta6deb27ba0252bc06fd6f28fb76b552e6320853f (diff)
downloadqtquickcontrols-533b45357246725efacf90b330a718d34a0cf3eb.tar.gz
TableView: Fix activated() not emitted
The mousearea in TableView has to accept mouse event in onPressed to receive upcoming double click event. Regression introduced by Iff3e5c1. Instead of not accepting the event in onPressed, set the MouseArea property propagateComposedEvents to true and does not accept the onClicked event. Also uses QStyle::SH_ItemView_ActivateItemOnSingleClick to check if the table is activated on single or double-clicking. By default, it is activated on double-clicking. Change-Id: I744174d7b31efebfae5e8db4db7b99a544ecf50f Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'tests/auto/controls/data/tst_tableview.qml')
-rw-r--r--tests/auto/controls/data/tst_tableview.qml30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_tableview.qml b/tests/auto/controls/data/tst_tableview.qml
index 65d7c72c..bc38ad46 100644
--- a/tests/auto/controls/data/tst_tableview.qml
+++ b/tests/auto/controls/data/tst_tableview.qml
@@ -180,6 +180,36 @@ TestCase {
table.destroy()
}
+ function test_activated() {
+ var component = Qt.createComponent("tableview/table_activated.qml")
+ compare(component.status, Component.Ready)
+ var table = component.createObject(container);
+ verify(table !== null, "table created is null")
+ table.forceActiveFocus();
+ compare(table.test, false)
+ if (!table.__activateItemOnSingleClick)
+ mouseDoubleClick(table, 15 , 15, Qt.LeftButton)
+ else
+ mouseClick(table, 15, 15, Qt.LeftButton)
+ compare(table.test, true)
+ table.destroy()
+ }
+
+ function test_activated_withItemDelegate() {
+ var component = Qt.createComponent("tableview/table_delegate.qml")
+ compare(component.status, Component.Ready)
+ var table = component.createObject(container);
+ verify(table !== null, "table created is null")
+ table.forceActiveFocus();
+ compare(table.activatedTest, false)
+ if (!table.__activateItemOnSingleClick)
+ mouseDoubleClick(table, 15 , 50, Qt.LeftButton)
+ else
+ mouseClick(table, 15, 50, Qt.LeftButton)
+ compare(table.activatedTest, true)
+ table.destroy()
+ }
+
function test_columnCount() {
var component = Qt.createComponent("tableview/table_multicolumns.qml")
compare(component.status, Component.Ready)