mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-09-02 10:24:01 +02:00
scrollbar fixes
This commit is contained in:
@@ -15,6 +15,7 @@ Rectangle {
|
|||||||
GridView {
|
GridView {
|
||||||
id: gridView
|
id: gridView
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
//anchors.rightMargin: scrollBar.width
|
||||||
|
|
||||||
cellHeight: cellWidth
|
cellHeight: cellWidth
|
||||||
cellWidth: calculateCoverSize(gridView.width - 3)
|
cellWidth: calculateCoverSize(gridView.width - 3)
|
||||||
@@ -51,4 +52,11 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScrollBar {
|
||||||
|
id: scrollBar
|
||||||
|
listView: gridView
|
||||||
|
orientation: Qt.Vertical
|
||||||
|
margin: -width
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -60,6 +60,7 @@ Rectangle {
|
|||||||
height: parent.height * 0.8
|
height: parent.height * 0.8
|
||||||
width: height
|
width: height
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
smooth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
@@ -9,6 +9,8 @@ Item {
|
|||||||
// the orientation of the scrollbar
|
// the orientation of the scrollbar
|
||||||
property variant orientation : Qt.Vertical
|
property variant orientation : Qt.Vertical
|
||||||
|
|
||||||
|
property int margin: defaultFontHeight * 0.25
|
||||||
|
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: "hidden"; when: !listView.moving
|
name: "hidden"; when: !listView.moving
|
||||||
@@ -34,9 +36,9 @@ Item {
|
|||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
left: orientation == Qt.Vertical ? listView.right : listView.left
|
left: orientation == Qt.Vertical ? listView.right : listView.left
|
||||||
leftMargin: orientation == Qt.Vertical ? defaultFontHeight / 4 : 0
|
leftMargin: orientation == Qt.Vertical ? scrollBar.margin : 0
|
||||||
top: orientation == Qt.Vertical ? listView.top : listView.bottom
|
top: orientation == Qt.Vertical ? listView.top : listView.bottom
|
||||||
topMargin: orientation == Qt.Vertical ? 0 : defaultFontHeight / 4
|
topMargin: orientation == Qt.Vertical ? 0 : scrollBar.margin
|
||||||
bottom: orientation == Qt.Vertical ? listView.bottom : undefined
|
bottom: orientation == Qt.Vertical ? listView.bottom : undefined
|
||||||
right: orientation == Qt.Vertical ? undefined : listView.right
|
right: orientation == Qt.Vertical ? undefined : listView.right
|
||||||
}
|
}
|
||||||
@@ -48,8 +50,7 @@ Item {
|
|||||||
radius: orientation == Qt.Vertical ? (width/2 - 1) : (height/2 - 1)
|
radius: orientation == Qt.Vertical ? (width/2 - 1) : (height/2 - 1)
|
||||||
color: "white"
|
color: "white"
|
||||||
opacity: 0.2
|
opacity: 0.2
|
||||||
}
|
clip: true
|
||||||
|
|
||||||
// Size the bar to the required size, depending upon the orientation.
|
// Size the bar to the required size, depending upon the orientation.
|
||||||
Rectangle {
|
Rectangle {
|
||||||
property real position: orientation == Qt.Vertical ? (listView.contentY / listView.contentHeight) : (listView.contentX / listView.contentWidth)
|
property real position: orientation == Qt.Vertical ? (listView.contentY / listView.contentHeight) : (listView.contentX / listView.contentWidth)
|
||||||
@@ -61,6 +62,8 @@ Item {
|
|||||||
height: orientation == Qt.Vertical ? (pageSize * (scrollBar.height-2)) : (parent.height-2)
|
height: orientation == Qt.Vertical ? (pageSize * (scrollBar.height-2)) : (parent.height-2)
|
||||||
radius: orientation == Qt.Vertical ? (width/2 - 1) : (height/2 - 1)
|
radius: orientation == Qt.Vertical ? (width/2 - 1) : (height/2 - 1)
|
||||||
color: "white"
|
color: "white"
|
||||||
opacity: 0.2
|
opacity: 1
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user