diff options
author | Jens Bache-Wiig <jens.bache-wiig@digia.com> | 2013-06-03 12:47:40 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-06-10 10:56:58 +0200 |
commit | 5303f814746606a78198fec5c02746c2f3090460 (patch) | |
tree | cfbb07343e0093cb8dd7dbf46fa539e042e965b5 /tests | |
parent | c7df1ebf207f99c7889c8834d16bf62fc99db75e (diff) | |
download | qtquickcontrols-5303f814746606a78198fec5c02746c2f3090460.tar.gz |
Updated activation signals in TableView
- Added row property to activated()
- Added clicked(row) signal
- Added doubleClicked(row) signal
- We also fixed the behavior so that we do not emit activated
if the user clicks outside of the available rows.
- We fixed a problem where key events would not be seen outside
of the control
Change-Id: I13feba26e900daf85be7be88216f1a0a4a446c57
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tableview/table_activated.qml | 17 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_tableview.qml | 20 |
2 files changed, 32 insertions, 5 deletions
diff --git a/tests/auto/controls/data/tableview/table_activated.qml b/tests/auto/controls/data/tableview/table_activated.qml index 52d420c4..227fbd88 100644 --- a/tests/auto/controls/data/tableview/table_activated.qml +++ b/tests/auto/controls/data/tableview/table_activated.qml @@ -42,11 +42,22 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 TableView { - height: 70 + height: 120 model: 10 - property bool test: false - onActivated: test = true + headerVisible: false + frameVisible: false + rowDelegate: Rectangle { + width: parent.width + height: 20 + } + + property int test: -1 + property int testClick: -1 + property int testDoubleClick: -1 + onActivated: test = row + onClicked: testClick = row + onDoubleClicked: testDoubleClick = row TableViewColumn { width: 100 diff --git a/tests/auto/controls/data/tst_tableview.qml b/tests/auto/controls/data/tst_tableview.qml index 8763900e..6779990c 100644 --- a/tests/auto/controls/data/tst_tableview.qml +++ b/tests/auto/controls/data/tst_tableview.qml @@ -198,12 +198,27 @@ TestCase { var table = component.createObject(container); verify(table !== null, "table created is null") table.forceActiveFocus(); - compare(table.test, false) + compare(table.test, -1) + compare(table.testClick, table.currentRow) + + if (!table.__activateItemOnSingleClick) + mouseDoubleClick(table, 15 , 45, Qt.LeftButton) + else + mouseClick(table, 15, 45, Qt.LeftButton) + + compare(table.testDoubleClick, table.currentRow) + compare(table.test, table.currentRow) + compare(table.testClick, table.currentRow) + if (!table.__activateItemOnSingleClick) mouseDoubleClick(table, 15 , 15, Qt.LeftButton) else mouseClick(table, 15, 15, Qt.LeftButton) - compare(table.test, true) + + compare(table.testDoubleClick, table.currentRow) + compare(table.testClick, table.currentRow) + compare(table.test, table.currentRow) + table.destroy() } @@ -214,6 +229,7 @@ TestCase { verify(table !== null, "table created is null") table.forceActiveFocus(); compare(table.activatedTest, false) + waitForRendering(table) if (!table.__activateItemOnSingleClick) mouseDoubleClick(table, 15 , 50, Qt.LeftButton) else |