diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-12-16 07:34:38 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-12-16 07:34:38 (GMT) |
commit | 7e8d529d1542b3c581cff27641ba7b37b40ca161 (patch) | |
tree | 8ee5d56a437d664a9137e1aeaa63056379daacca /examples | |
parent | cc581fd06ed8b017aa7c87f740056921479f23f8 (diff) | |
download | Qt-7e8d529d1542b3c581cff27641ba7b37b40ca161.zip Qt-7e8d529d1542b3c581cff27641ba7b37b40ca161.tar.gz Qt-7e8d529d1542b3c581cff27641ba7b37b40ca161.tar.bz2 |
Allow a ListView.section.delegate to avoid creating sections in delegate.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/declarative/listview/sections.qml | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/examples/declarative/listview/sections.qml b/examples/declarative/listview/sections.qml index b51cf58..6e72ce7 100644 --- a/examples/declarative/listview/sections.qml +++ b/examples/declarative/listview/sections.qml @@ -17,25 +17,11 @@ Rectangle { id: wrapper width: 200 // My height is the combined height of the description and the section separator - height: separator.height + desc.height - Rectangle { - id: separator - color: "lightsteelblue" - width: parent.width - // Only show the section separator when we are the beginning of a new section - // Note that for this to work nicely, the list must be ordered by section. - height: wrapper.ListView.prevSection != wrapper.ListView.section ? 20 : 0 - opacity: wrapper.ListView.prevSection != wrapper.ListView.section ? 1 : 0 - Text { - text: wrapper.ListView.section; font.bold: true - x: 2; height: parent.height; verticalAlignment: 'AlignVCenter' - } - } + height: desc.height Item { id: desc x: 5 height: layout.height + 4 - anchors.top: separator.bottom Column { id: layout y: 2 @@ -66,6 +52,15 @@ Rectangle { // We use this to determine which section we are in above. section.property: "size" section.criteria: ViewSection.FullString + section.delegate: Rectangle { + color: "lightsteelblue" + width: 200 + height: 20 + Text { + text: section; font.bold: true + x: 2; height: parent.height; verticalAlignment: 'AlignVCenter' + } + } focus: true } } |