From 18d6a09dc9c3cf20ed5f15390bc336ed9aafc1be Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Tue, 26 Jan 2016 23:16:22 -0800 Subject: [PATCH] Better preferences dialog initial state --- interface/resources/qml/dialogs/PreferencesDialog.qml | 7 +++++++ interface/resources/qml/dialogs/preferences/Section.qml | 4 ++++ tests/ui/qmlscratch.pro | 1 + 3 files changed, 12 insertions(+) diff --git a/interface/resources/qml/dialogs/PreferencesDialog.qml b/interface/resources/qml/dialogs/PreferencesDialog.qml index bb3ce43fcd..8eee78719b 100644 --- a/interface/resources/qml/dialogs/PreferencesDialog.qml +++ b/interface/resources/qml/dialogs/PreferencesDialog.qml @@ -62,6 +62,13 @@ Window { sections.push(sectionBuilder.createObject(prefControls, { name: category })); } + + if (sections.length) { + sections[0].expanded = true; + if (sections.length === 1) { + sections[0].expandable = false + } + } } Flickable { diff --git a/interface/resources/qml/dialogs/preferences/Section.qml b/interface/resources/qml/dialogs/preferences/Section.qml index 4b2c92f867..2cf232864d 100644 --- a/interface/resources/qml/dialogs/preferences/Section.qml +++ b/interface/resources/qml/dialogs/preferences/Section.qml @@ -7,6 +7,7 @@ import "." Preference { id: root + property bool expandable: true property bool expanded: false property string name: "Header" property real spacing: 8 @@ -42,7 +43,10 @@ Preference { VrControls.FontAwesome { id: toggle + width: root.expandable ? height : 0 anchors { left: parent.left; top: parent.top; margins: root.spacing } + visible: root.expandable + enabled: root.expandable rotation: root.expanded ? 0 : -90 text: "\uf078" Behavior on rotation { PropertyAnimation {} } diff --git a/tests/ui/qmlscratch.pro b/tests/ui/qmlscratch.pro index 7a1b5ab652..a4e4b33957 100644 --- a/tests/ui/qmlscratch.pro +++ b/tests/ui/qmlscratch.pro @@ -20,6 +20,7 @@ DISTFILES += \ ../../interface/resources/qml/controls/*.qml \ ../../interface/resources/qml/dialogs/*.qml \ ../../interface/resources/qml/dialogs/fileDialog/*.qml \ + ../../interface/resources/qml/dialogs/preferences/*.qml \ ../../interface/resources/qml/desktop/*.qml \ ../../interface/resources/qml/menus/*.qml \ ../../interface/resources/qml/styles/*.qml \