on xenial help sign in
First attempt at showing the arrow

Not really happy with it

commit62673070382afbdeb26b30b2eecfb75f3eea5690 authorAlbert Astals <albert.astals@canonical.com> dateWed 7 Aug 2013, 12:13 (13 years ago) parent8c9c1ed
5 files changed+26−2
Components/ListItems/Header.qml+11−2 Dash/GenericScopeView.qml+11 Dash/graphics/header_handlearrow2@20.png Dash/graphics/header_handlearrow@20.png plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+4
Components/ListItems/Header.qml+11−2
@@ -24,6 +24,7 @@ Item {
2424 \qmlproperty string text
2525 */
2626 property alias text: label.text
27+ property alias image: image.source
2728
2829 signal clicked(variant mouse)
2930
@@ -33,6 +34,7 @@ Item {
3334 anchors {
3435 left: parent.left
3536 right: parent.right
37+ rightMargin: units.gu(0.5)
3638 top: parent.top
3739 bottom: bottomBorder.top
3840 }
@@ -42,8 +44,6 @@ Item {
4244 anchors {
4345 left: parent.left
4446 leftMargin: units.gu(2)
45− right: parent.right
46− rightMargin: units.gu(0.5)
4747 verticalCenter: parent.verticalCenter
4848 }
4949
@@ -56,6 +56,15 @@ Item {
5656 style: Text.Raised
5757 styleColor: "black"
5858 }
59+
60+ Image {
61+ id: image
62+ anchors {
63+ left: label.right
64+ leftMargin: units.gu(1)
65+ verticalCenter: parent.verticalCenter
66+ }
67+ }
5968 }
6069
6170 ThinDivider {
Dash/GenericScopeView.qml+11
@@ -58,6 +58,9 @@ ScopeView {
5858 delegate: ListItems.Base {
5959 highlightWhenPressed: false
6060
61+ property bool expandable: rendererLoader.item ? rendererLoader.item.expandable : false
62+ property bool filtered: rendererLoader.item ? rendererLoader.item.filter : true
63+
6164 function toggleCollapse() {
6265 if (rendererLoader.item.expandable) {
6366 if (index != categoryView.expandedIndex && categoryView.expandedIndex != -1) {
@@ -125,8 +128,16 @@ ScopeView {
125128
126129 sectionProperty: "name"
127130 sectionDelegate: ListItems.Header {
131+ property var delegate: categoryView.item(delegateIndex)
128132 width: categoryView.width
129133 text: section
134+ image: {
135+ if (delegate) {
136+ if (delegate.expandable)
137+ return delegate.filtered ? "graphics/header_handlearrow.png" : "graphics/header_handlearrow2.png"
138+ }
139+ return "";
140+ }
130141 onClicked: {
131142 var obj = categoryView.item(delegateIndex);
132143 if (obj)
Dash/graphics/header_handlearrow2@20.pngnew file

Binary file not shown.

Dash/graphics/header_handlearrow@20.pngnew file

Binary file not shown.

plugins/ListViewWithPageHeader/listviewwithpageheader.cpp+4
@@ -779,6 +779,10 @@ ListViewWithPageHeader::ListItem *ListViewWithPageHeader::createItem(int modelIn
779779 m_firstVisibleIndex = modelIndex;
780780 polish();
781781 }
782+ if (listItem->m_sectionItem) {
783+ QQmlContext *context = QQmlEngine::contextForObject(listItem->m_sectionItem)->parentContext();
784+ context->setContextProperty(QLatin1String("delegateIndex"), modelIndex);
785+ }
782786 adjustMinYExtent();
783787 m_contentHeightDirty = true;
784788 }