Set up window pane's content width so that can right-align

This commit is contained in:
David Rowe 2016-02-17 15:35:35 +13:00
parent 30498760b0
commit 1164e3e303
3 changed files with 15 additions and 12 deletions

View file

@ -80,6 +80,7 @@ Window {
}
Column {
width: pane.contentWidth
HifiControls.StaticSection {
name: "Currently Running"

View file

@ -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;
}

View file

@ -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();