summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/src/snippets/declarative/listview/highlight.qml10
-rw-r--r--src/declarative/QmlChanges.txt2
-rw-r--r--src/declarative/fx/qfxlistview.cpp22
-rw-r--r--src/declarative/fx/qfxlistview.h16
4 files changed, 23 insertions, 27 deletions
diff --git a/doc/src/snippets/declarative/listview/highlight.qml b/doc/src/snippets/declarative/listview/highlight.qml
index 29f41bf..97eac45 100644
--- a/doc/src/snippets/declarative/listview/highlight.qml
+++ b/doc/src/snippets/declarative/listview/highlight.qml
@@ -15,7 +15,7 @@ Rectangle {
Item {
id: Wrapper
width: 180; height: 40
- VerticalLayout {
+ Column {
x: 5; y: 5
Text { text: '<b>Name:</b> ' + name }
Text { text: '<b>Number:</b> ' + number }
@@ -32,10 +32,10 @@ Rectangle {
Rectangle {
width: 180; height: 40
color: "lightsteelblue"; radius: 5
- y: Follow {
- source: List.current.y
+ y: SpringFollow {
+ source: List.currentItem.y
spring: 3
- damping: 0.1
+ damping: 0.2
}
}
}
@@ -44,7 +44,7 @@ Rectangle {
width: parent.height; height: parent.height
model: ContactModel; delegate: Delegate
highlight: Highlight
- autoHighlight: false
+ highlightFollowsCurrentItem: false
focus: true
}
//! [1]
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt
index 4afffd5..25af3b1 100644
--- a/src/declarative/QmlChanges.txt
+++ b/src/declarative/QmlChanges.txt
@@ -66,6 +66,8 @@ Repeater: component -> delegate
Repeater: dataSource -> model
ListView: current -> currentItem
GridView: current -> currentItem
+ListView: wrap -> keyNavigationWraps
+ListView: autoHighlight -> highlightFollowsCurrentItem
Additions:
MouseRegion: add "acceptedButtons" property
diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp
index cd47448..6fa1172 100644
--- a/src/declarative/fx/qfxlistview.cpp
+++ b/src/declarative/fx/qfxlistview.cpp
@@ -443,7 +443,7 @@ FxListItem *QFxListViewPrivate::createItem(int modelIndex)
}
// complete
model->completeItem();
- listItem->item->setZValue(modelIndex + 1);
+ listItem->item->setZValue(1);
listItem->item->setParent(q->viewport());
if (orient == Qt::Vertical)
QObject::connect(listItem->item, SIGNAL(heightChanged()), q, SLOT(itemResized()));
@@ -664,6 +664,7 @@ void QFxListViewPrivate::createHighlight()
item->setParent(q->viewport());
}
if (item) {
+ item->setZValue(0);
highlight = new FxListItem(item, q);
if (orient == Qt::Vertical)
highlight->item->setHeight(currentItem->item->height());
@@ -1018,7 +1019,8 @@ int QFxListView::count() const
An instance of the highlight component will be created for each list.
The geometry of the resultant component instance will be managed by the list
- so as to stay with the current item, unless the autoHighlight property is false.
+ so as to stay with the current item, unless the highlightFollowsCurrentItem
+ property is false.
The below example demonstrates how to make a simple highlight
for a vertical list.
@@ -1026,7 +1028,7 @@ int QFxListView::count() const
\snippet doc/src/snippets/declarative/listview/listview.qml 1
\image trivialListView.png
- \sa autoHighlight
+ \sa highlightFollowsCurrentItem
*/
QmlComponent *QFxListView::highlight() const
{
@@ -1043,11 +1045,11 @@ void QFxListView::setHighlight(QmlComponent *highlight)
}
/*!
- \qmlproperty bool ListView::autoHighlight
+ \qmlproperty bool ListView::highlightFollowsCurrentItem
This property holds whether the highlight is managed by the view.
- If autoHighlight is true, the highlight will be moved smoothly
- to follow the current item. If autoHighlight is false, the
+ If highlightFollowsCurrentItem is true, the highlight will be moved smoothly
+ to follow the current item. If highlightFollowsCurrentItem is false, the
highlight will not be moved by the view, and must be implemented
by the highlight. The following example creates a highlight with
its motion defined by the spring \l {SpringFollow}:
@@ -1056,13 +1058,13 @@ void QFxListView::setHighlight(QmlComponent *highlight)
\sa highlight
*/
-bool QFxListView::autoHighlight() const
+bool QFxListView::highlightFollowsCurrentItem() const
{
Q_D(const QFxListView);
return d->autoHighlight;
}
-void QFxListView::setAutoHighlight(bool autoHighlight)
+void QFxListView::setHighlightFollowsCurrentItem(bool autoHighlight)
{
Q_D(QFxListView);
d->autoHighlight = autoHighlight;
@@ -1182,11 +1184,11 @@ void QFxListView::setOrientation(Qt::Orientation orientation)
}
/*!
- \qmlproperty bool ListView::wrap
+ \qmlproperty bool ListView::keyNavigationWraps
This property holds whether the list wraps key navigation
If this property is true then key presses to move off of one end of the list will cause the
- selection to jump to the other side.
+ current item to jump to the other end.
*/
bool QFxListView::isWrapEnabled() const
{
diff --git a/src/declarative/fx/qfxlistview.h b/src/declarative/fx/qfxlistview.h
index b122a8a..1e63272 100644
--- a/src/declarative/fx/qfxlistview.h
+++ b/src/declarative/fx/qfxlistview.h
@@ -50,7 +50,6 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
-//### get rid of z = index and set known z-value (1 for items, 0 for highlight)
//### incrementCurrentIndex(), decrementCurrentIndex() slots
//### default Keys.OnUp/DownPressed handler
@@ -70,7 +69,7 @@ class Q_DECLARATIVE_EXPORT QFxListView : public QFxFlickable
Q_PROPERTY(QFxItem *currentItem READ currentItem NOTIFY currentIndexChanged)
Q_PROPERTY(int count READ count NOTIFY countChanged)
Q_PROPERTY(QmlComponent *highlight READ highlight WRITE setHighlight)
- Q_PROPERTY(bool autoHighlight READ autoHighlight WRITE setAutoHighlight) //### highlightFollowsCurrentItem
+ Q_PROPERTY(bool highlightFollowsCurrentItem READ highlightFollowsCurrentItem WRITE setHighlightFollowsCurrentItem)
Q_PROPERTY(qreal preferredHighlightBegin READ preferredHighlightBegin WRITE setPreferredHighlightBegin)
Q_PROPERTY(qreal preferredHighlightEnd READ preferredHighlightEnd WRITE setPreferredHighlightEnd)
@@ -78,7 +77,7 @@ class Q_DECLARATIVE_EXPORT QFxListView : public QFxFlickable
Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing NOTIFY spacingChanged)
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
- Q_PROPERTY(bool wrap READ isWrapEnabled WRITE setWrapEnabled) //### keyNavigationWraps, stops at end when held
+ Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled)
Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer)
Q_PROPERTY(QString sectionExpression READ sectionExpression WRITE setSectionExpression NOTIFY sectionExpressionChanged)
Q_PROPERTY(QString currentSection READ currentSection NOTIFY currentSectionChanged)
@@ -103,15 +102,8 @@ public:
QmlComponent *highlight() const;
void setHighlight(QmlComponent *highlight);
- bool autoHighlight() const;
- void setAutoHighlight(bool);
-
- enum CurrentItemPositioning { Free, Snap, SnapAuto };
- CurrentItemPositioning currentItemPositioning() const;
- void setCurrentItemPositioning(CurrentItemPositioning mode);
-
- int snapPosition() const;
- void setSnapPosition(int pos);
+ bool highlightFollowsCurrentItem() const;
+ void setHighlightFollowsCurrentItem(bool);
bool strictlyEnforceHighlightRange() const;
void setStrictlyEnforceHighlightRange(bool strict);