diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index c954b2a1eb233a7f608fc2238d38a0f404ed70c0..4441207e72aec17b64683fc9f0ba61e1705cc582 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -247,8 +247,6 @@ ScrollView { If positioning the \a row creates an empty space at the beginning or end of the view, then the view is positioned at the boundary. - Note that this method should only be called after the Component has completed. - To position the view at startup, this method should be called by Component.onCompleted. For example, to position the view at the end at startup: \code @@ -259,12 +257,29 @@ ScrollView { TableView Component.onCompleted is called. In that case you may need to delay the call to positionViewAtRow by using a \l {Timer}. + \note This method should only be called after the component has completed. */ function positionViewAtRow(row, mode) { listView.positionViewAtRow(row, mode) } + /*! + \qmlmethod int TableView::rowAt( int x, int y ) + + Returns the 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, \c -1 is returned. + + \note This method should only be called after the component has completed. + */ + + function rowAt(x, y) { + if (headerVisible) + y -= headerrow.height + return listView.indexAt(x, y) + } + + style: Qt.createComponent(Settings.theme() + "/TableViewStyle.qml", root)