diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-02-22 23:55:24 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-02-23 00:10:08 (GMT) |
commit | f93d1245e5c36cf25cd6fd3c3418ee7e63e04ac2 (patch) | |
tree | 028b525e7d77580edd8dffe4cda33ba418fa0710 /src | |
parent | bf9ca539dc4c5efff801856ad9d3f7e14dabad26 (diff) | |
download | Qt-f93d1245e5c36cf25cd6fd3c3418ee7e63e04ac2.zip Qt-f93d1245e5c36cf25cd6fd3c3418ee7e63e04ac2.tar.gz Qt-f93d1245e5c36cf25cd6fd3c3418ee7e63e04ac2.tar.bz2 |
ListView and GridView indexAt should use qreal coordinates.
Change-Id: Ibe6969b5c3209062213c6582eaf4c285bcb793de
Task-number: QTBUG-17594
Reviewed-by: Bea Lam
Diffstat (limited to 'src')
4 files changed, 6 insertions, 6 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 694130b..6d2285d 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -82,7 +82,7 @@ public: item->setPos(QPointF(row, col)); } } - bool contains(int x, int y) const { + bool contains(qreal x, qreal y) const { return (x >= item->x() && x < item->x() + view->cellWidth() && y >= item->y() && y < item->y() + view->cellHeight()); } @@ -2294,7 +2294,7 @@ void QDeclarativeGridView::positionViewAtEnd() \bold Note: methods should only be called after the Component has completed. */ -int QDeclarativeGridView::indexAt(int x, int y) const +int QDeclarativeGridView::indexAt(qreal x, qreal y) const { Q_D(const QDeclarativeGridView); for (int i = 0; i < d->visibleItems.count(); ++i) { diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h index 248b9ef..e68a9ba 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview_p.h +++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h @@ -158,7 +158,7 @@ public: enum PositionMode { Beginning, Center, End, Visible, Contain }; Q_INVOKABLE void positionViewAtIndex(int index, int mode); - Q_INVOKABLE int indexAt(int x, int y) const; + Q_INVOKABLE int indexAt(qreal x, qreal y) const; Q_INVOKABLE Q_REVISION(1) void positionViewAtBeginning(); Q_INVOKABLE Q_REVISION(1) void positionViewAtEnd(); diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index a60a4aa..91de5a6 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -148,7 +148,7 @@ public: else item->setWidth(size); } - bool contains(int x, int y) const { + bool contains(qreal x, qreal y) const { return (x >= item->x() && x < item->x() + item->width() && y >= item->y() && y < item->y() + item->height()); } @@ -2732,7 +2732,7 @@ void QDeclarativeListView::positionViewAtEnd() \bold Note: methods should only be called after the Component has completed. */ -int QDeclarativeListView::indexAt(int x, int y) const +int QDeclarativeListView::indexAt(qreal x, qreal y) const { Q_D(const QDeclarativeListView); for (int i = 0; i < d->visibleItems.count(); ++i) { diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h index 10fbf10..265f4bd 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview_p.h +++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h @@ -208,7 +208,7 @@ public: enum PositionMode { Beginning, Center, End, Visible, Contain }; Q_INVOKABLE void positionViewAtIndex(int index, int mode); - Q_INVOKABLE int indexAt(int x, int y) const; + Q_INVOKABLE int indexAt(qreal x, qreal y) const; Q_INVOKABLE Q_REVISION(1) void positionViewAtBeginning(); Q_INVOKABLE Q_REVISION(1) void positionViewAtEnd(); |