summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativelistview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativelistview.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 110c970..82b3e1c 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -60,7 +60,7 @@ void QDeclarativeViewSection::setProperty(const QString &property)
{
if (property != m_property) {
m_property = property;
- emit changed();
+ emit propertyChanged();
}
}
@@ -68,7 +68,7 @@ void QDeclarativeViewSection::setCriteria(QDeclarativeViewSection::SectionCriter
{
if (criteria != m_criteria) {
m_criteria = criteria;
- emit changed();
+ emit criteriaChanged();
}
}
@@ -575,6 +575,8 @@ FxListItem *QDeclarativeListViewPrivate::createItem(int modelIndex)
listItem->attached->m_prevSection = item->attached->section();
else
listItem->attached->m_prevSection = sectionAt(modelIndex-1);
+ }
+ if (modelIndex < model->count()-1) {
if (FxListItem *item = visibleItem(modelIndex+1))
listItem->attached->m_nextSection = item->attached->section();
else
@@ -1385,14 +1387,16 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m
the delegate is able to access the model's \c name and \c number data directly.
An improved list view is shown below. The delegate is visually improved and is moved
- into a separate \c contactDelegate component. Also, the currently selected item is highlighted
- with a blue \l Rectangle using the \l highlight property, and \c focus is set to \c true
- to enable keyboard navigation for the list view.
+ into a separate \c contactDelegate component.
\snippet doc/src/snippets/declarative/listview/listview.qml classdocs advanced
\image listview-highlight.png
- In a GridView, delegates are instantiated as needed and may be destroyed at any time.
+ The currently selected item is highlighted with a blue \l Rectangle using the \l highlight property,
+ and \c focus is set to \c true to enable keyboard navigation for the list view.
+ The list view itself is a focus scope (see \l{qmlfocus#Acquiring Focus and Focus Scopes}{the focus documentation page} for more details).
+
+ Delegates are instantiated as needed and may be destroyed at any time.
State should \e never be stored in a delegate.
\note Views do not enable \e clip automatically. If the view
@@ -1616,6 +1620,8 @@ void QDeclarativeListView::setDelegate(QDeclarativeComponent *delegate)
for (int i = 0; i < d->visibleItems.count(); ++i)
d->releaseItem(d->visibleItems.at(i));
d->visibleItems.clear();
+ d->releaseItem(d->currentItem);
+ d->currentItem = 0;
refill();
d->moveReason = QDeclarativeListViewPrivate::SetIndex;
d->updateCurrent(d->currentIndex);
@@ -1632,8 +1638,14 @@ void QDeclarativeListView::setDelegate(QDeclarativeComponent *delegate)
\qmlproperty int ListView::currentIndex
\qmlproperty Item ListView::currentItem
- \c currentIndex holds the index of the current item.
- \c currentItem is the current item. Note that the position of the current item
+ The \c currentIndex property holds the index of the current item, and
+ \c currentItem holds the current item.
+
+ If highlightFollowsCurrentItem is \c true, setting either of these
+ properties will smoothly scroll the ListView so that the current
+ item becomes visible.
+
+ Note that the position of the current item
may only be approximate until it becomes visible in the view.
*/
int QDeclarativeListView::currentIndex() const
@@ -1727,12 +1739,12 @@ void QDeclarativeListView::setHighlight(QDeclarativeComponent *highlight)
\qmlproperty bool ListView::highlightFollowsCurrentItem
This property holds whether the highlight is managed by the view.
- If this property is true, the highlight is moved smoothly
+ If this property is true (the default value), the highlight is moved smoothly
to follow the current item. Otherwise, the
highlight is not moved by the view, and any movement must be implemented
by the highlight.
- Here is a highlight with its motion defined by a \l {SpringAniamtion} item:
+ Here is a highlight with its motion defined by a \l {SpringAnimation} item:
\snippet doc/src/snippets/declarative/listview/listview.qml highlightFollowsCurrentItem
@@ -1848,6 +1860,8 @@ void QDeclarativeListView::setHighlightRangeMode(HighlightRangeMode mode)
\qmlproperty real ListView::spacing
This property holds the spacing between items.
+
+ The default value is 0.
*/
qreal QDeclarativeListView::spacing() const
{
@@ -1914,11 +1928,13 @@ void QDeclarativeListView::setOrientation(QDeclarativeListView::Orientation orie
/*!
\qmlproperty bool ListView::keyNavigationWraps
- This property holds whether the list wraps key navigation.
+ This property holds whether the list wraps key navigation.
If this is true, key navigation that would move the current item selection
past the end of the list instead wraps around and moves the selection to
the start of the list, and vice-versa.
+
+ By default, key navigation is not wrapped.
*/
bool QDeclarativeListView::isWrapEnabled() const
{