summaryrefslogtreecommitdiff
path: root/src/controls/TreeView.qml
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>2015-04-07 15:52:12 +0200
committerGabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>2015-04-16 09:06:16 +0000
commit235abf6486c221e4dc763b614ac33771abdd8f3f (patch)
tree979810fbb70d3c74a2d9ba3c68ce45363e5538d3 /src/controls/TreeView.qml
parent564fdbc1985f6de95d68ed7c7e64614bf5fc7d76 (diff)
downloadqtquickcontrols-235abf6486c221e4dc763b614ac33771abdd8f3f.tar.gz
TreeView: Add indexAt() function
Change-Id: I6a8105d074fd71d9d0dff35d07ba1622093e1d4b Task-number: QTBUG-45351 Reviewed-by: Filippo Cucchetto <filippocucchetto@gmail.com> Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/controls/TreeView.qml')
-rw-r--r--src/controls/TreeView.qml14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/controls/TreeView.qml b/src/controls/TreeView.qml
index 8de10493..534f2e91 100644
--- a/src/controls/TreeView.qml
+++ b/src/controls/TreeView.qml
@@ -252,6 +252,20 @@ BasicTableView {
modelAdaptor.expand(index)
}
+ /*!
+ \qmlmethod QModelIndex TreeView::indexAt( int x, int y )
+
+ Returns the model index of the visible row at the point \a x, \a y in content
+ coordinates. If there is no visible row at the point specified, an invalid
+ \l QModelIndex is returned.
+
+ \note This method should only be called after the component has completed.
+ */
+ function indexAt(x, y) {
+ var obj = root.mapToItem(__listView.contentItem, x, y)
+ return modelAdaptor.mapRowToModelIndex(__listView.indexAt(obj.x, obj.y))
+ }
+
style: Settings.styleComponent(Settings.style, "TreeViewStyle.qml", root)
// Internal stuff. Do not look