From 1164e3e303da1bea2726e7c996795ffd8e386318 Mon Sep 17 00:00:00 2001 From: David Rowe Date: Wed, 17 Feb 2016 15:35:35 +1300 Subject: [PATCH] Set up window pane's content width so that can right-align --- .../qml/hifi/dialogs/RunningScripts.qml | 1 + interface/resources/qml/windows-uit/Frame.qml | 10 +++++----- interface/resources/qml/windows-uit/Window.qml | 16 +++++++++------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/interface/resources/qml/hifi/dialogs/RunningScripts.qml b/interface/resources/qml/hifi/dialogs/RunningScripts.qml index f71de438a0..de0f179fe3 100644 --- a/interface/resources/qml/hifi/dialogs/RunningScripts.qml +++ b/interface/resources/qml/hifi/dialogs/RunningScripts.qml @@ -80,6 +80,7 @@ Window { } Column { + width: pane.contentWidth HifiControls.StaticSection { name: "Currently Running" diff --git a/interface/resources/qml/windows-uit/Frame.qml b/interface/resources/qml/windows-uit/Frame.qml index 2ae8837ff3..8c5ac5e766 100644 --- a/interface/resources/qml/windows-uit/Frame.qml +++ b/interface/resources/qml/windows-uit/Frame.qml @@ -59,7 +59,7 @@ Item { height: width x: -width / 4 y: -width / 4 - visible: window && window.focus && windowContent.visible + visible: window && window.focus && pane.visible gradient: Gradient { // GradientStop position 0.5 is at full circumference of circle that fits inside the square. GradientStop { position: 0.0; color: "#ff000000" } // black, 100% opacity @@ -79,7 +79,7 @@ Item { border.width: 3 border.color: hifi.colors.white50 radius: hifi.dimensions.borderRadius - visible: window ? !windowContent.visible : false + visible: window ? !pane.visible : false } MouseArea { @@ -102,15 +102,15 @@ Item { } onReleased: { if (hid) { - windowContent.visible = true + pane.visible = true frameContent.visible = true hid = false; } } onPositionChanged: { if (pressed) { - if (windowContent.visible) { - windowContent.visible = false; + if (pane.visible) { + pane.visible = false; frameContent.visible = false hid = true; } diff --git a/interface/resources/qml/windows-uit/Window.qml b/interface/resources/qml/windows-uit/Window.qml index 73680229e0..ab73566bcf 100644 --- a/interface/resources/qml/windows-uit/Window.qml +++ b/interface/resources/qml/windows-uit/Window.qml @@ -120,15 +120,17 @@ Fadable { property var frame: DefaultFrame { } // Scrollable window content. - property var scroller: Item { - id: windowContent + property var pane: Item { + property bool isScrolling: scrollView.height < scrollView.contentItem.height + property int contentWidth: scrollView.width - (isScrolling ? 11 : 0) + anchors.fill: parent - anchors.rightMargin: theScrollView.height < theScrollView.contentItem.height ? 11 : 0 + anchors.rightMargin: isScrolling ? 11 : 0 Rectangle { id: contentBackground anchors.fill: parent - anchors.rightMargin: theScrollView.height < theScrollView.contentItem.height ? 11 : 0 + anchors.rightMargin: parent.isScrolling ? 11 : 0 color: hifi.colors.baseGray } @@ -146,12 +148,12 @@ Fadable { } ScrollView { - id: theScrollView + id: scrollView contentItem: content horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff verticalScrollBarPolicy: Qt.ScrollBarAsNeeded anchors.fill: parent - anchors.rightMargin: height < contentItem.height ? 1 : 0 + anchors.rightMargin: parent.isScrolling ? 1 : 0 style: ScrollViewStyle { @@ -195,7 +197,7 @@ Fadable { } } - children: [ swallower, frame, scroller, activator ] + children: [ swallower, frame, pane, activator ] Component.onCompleted: raise(); Component.onDestruction: windowDestroyed();