mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-05 23:00:18 +02:00
Next attempt to fix ghosted scroll bars
This commit is contained in:
parent
86b9e1b873
commit
698a224bb0
1 changed files with 18 additions and 15 deletions
|
@ -38,24 +38,26 @@ Window {
|
||||||
property bool keyboardRaised: false
|
property bool keyboardRaised: false
|
||||||
property bool punctuationMode: false
|
property bool punctuationMode: false
|
||||||
|
|
||||||
|
readonly property real verticalScrollWidth: 10
|
||||||
|
readonly property real verticalScrollShaft: 8
|
||||||
|
|
||||||
|
|
||||||
// Scrollable window content.
|
// Scrollable window content.
|
||||||
// FIXME this should not define any visual content in this type. The base window
|
// FIXME this should not define any visual content in this type. The base window
|
||||||
// type should only consist of logic sized areas, with nothing drawn (although the
|
// type should only consist of logic sized areas, with nothing drawn (although the
|
||||||
// default value for the frame property does include visual decorations)
|
// default value for the frame property does include visual decorations)
|
||||||
property var pane: Item {
|
property var pane: Item {
|
||||||
property bool isScrolling: scrollView.contentHeight > scrollView.availableHeight
|
property bool isScrolling: Qt.binding(function() { return scrollView.contentHeight > scrollView.availableHeight; });
|
||||||
|
|
||||||
property int contentWidth: scrollView.width - (isScrolling ? 10 : 0)
|
property int contentWidth: scrollView.availableWidth
|
||||||
property int scrollHeight: scrollView.height
|
property int scrollHeight: scrollView.availableHeight
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.rightMargin: isScrolling ? 11 : 0
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: contentBackground
|
id: contentBackground
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.rightMargin: parent.isScrolling ? 11 : 0
|
//anchors.rightMargin: parent.isScrolling ? verticalScrollWidth + 1 : 0
|
||||||
color: hifi.colors.baseGray
|
color: hifi.colors.baseGray
|
||||||
visible: !window.hideBackground && modality != Qt.ApplicationModal
|
visible: !window.hideBackground && modality != Qt.ApplicationModal
|
||||||
}
|
}
|
||||||
|
@ -77,22 +79,23 @@ Window {
|
||||||
|
|
||||||
ScrollView {
|
ScrollView {
|
||||||
id: scrollView
|
id: scrollView
|
||||||
contentItem: content
|
contentChildren: content
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
|
anchors.rightMargin: parent.isScrolling ? verticalScrollWidth : 0
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.rightMargin: parent.isScrolling ? 1 : 0
|
|
||||||
anchors.bottomMargin: footerPane.height
|
anchors.bottomMargin: footerPane.height
|
||||||
|
|
||||||
ScrollBar.vertical: ScrollBar {
|
ScrollBar.vertical: ScrollBar {
|
||||||
policy: ScrollBar.AsNeeded
|
policy: scrollView.contentHeight > scrollView.availableHeight ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
|
||||||
x: scrollView.width - width
|
parent: scrollView.parent
|
||||||
y: scrollView.topPadding
|
anchors.top: scrollView.top
|
||||||
height: scrollView.availableHeight
|
anchors.right: scrollView.right
|
||||||
visible: scrollView.contentHeight > scrollView.availableHeight
|
anchors.bottom: scrollView.bottom
|
||||||
|
anchors.rightMargin: -verticalScrollWidth //compensate scrollview's right margin
|
||||||
background: Item {
|
background: Item {
|
||||||
implicitWidth: 10
|
implicitWidth: verticalScrollWidth
|
||||||
Rectangle {
|
Rectangle {
|
||||||
color: hifi.colors.darkGray30
|
color: hifi.colors.darkGray30
|
||||||
radius: 4
|
radius: 4
|
||||||
|
@ -104,9 +107,9 @@ Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
implicitWidth: 8
|
implicitWidth: verticalScrollShaft
|
||||||
Rectangle {
|
Rectangle {
|
||||||
radius: 4
|
radius: verticalScrollShaft/2
|
||||||
color: hifi.colors.white30
|
color: hifi.colors.white30
|
||||||
anchors {
|
anchors {
|
||||||
fill: parent
|
fill: parent
|
||||||
|
|
Loading…
Reference in a new issue