mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-22 19:49:34 +00:00
StandardDropdown: Add Flickable and ScrollBar to droplist
This commit adds a Flickable and ScrollBar to the StandardDropdown component. The use case is for the list of fiat currencies which is flowing off-screen. Tested on ASUSTek laptop touchpad. Fixes: 302490e ("Add additional fiat currencies")
This commit is contained in:
parent
002fe8eefa
commit
6778e7261b
1 changed files with 88 additions and 61 deletions
|
@ -146,11 +146,37 @@ ColumnLayout {
|
|||
padding: 0
|
||||
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
||||
|
||||
Flickable {
|
||||
id: flickable
|
||||
flickableDirection: Flickable.VerticalFlick
|
||||
clip: true
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
contentHeight: contentItem.childrenRect.height
|
||||
contentWidth: contentItem.childrenRect.width
|
||||
width: dropdown.width
|
||||
height: 240
|
||||
y: head.height + head.y
|
||||
flickDeceleration: 35000
|
||||
onAtYEndChanged: {
|
||||
if (flickable.atYEnd) {
|
||||
// hack for getting that last item Flickable seems to hate showing
|
||||
}
|
||||
}
|
||||
// put a mouse area on the flickable since we don't have access to the previous one
|
||||
MouseArea {
|
||||
id: dropArea2
|
||||
anchors.fill: parent
|
||||
onClicked: dropdown.expanded ? popup.close() : popup.open()
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.ArrowCursor
|
||||
onPressed: flickable.interactive = false
|
||||
onReleased: flickable.interactive = true
|
||||
}
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
Rectangle {
|
||||
id: droplist
|
||||
anchors.left: parent.left
|
||||
width: dropdown.width
|
||||
y: head.y + head.height
|
||||
clip: true
|
||||
height: dropdown.expanded ? columnid.height : 0
|
||||
color: dropdown.pressedColor
|
||||
|
@ -225,4 +251,5 @@ ColumnLayout {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue