wrap mpris player selection pills into multiple rows with Flow
This commit is contained in:
parent
1b6c2fee91
commit
22ca356fb5
1 changed files with 35 additions and 43 deletions
|
|
@ -306,58 +306,50 @@ Column {
|
|||
// Player switcher
|
||||
Item {
|
||||
width: root.width
|
||||
height: root.players.length > 1 ? 28 : 0
|
||||
height: root.players.length > 1 ? _playerFlow.implicitHeight + 6 : 0
|
||||
visible: root.players.length > 1
|
||||
|
||||
Flickable {
|
||||
id: _switcher
|
||||
anchors.centerIn: parent
|
||||
width: Math.min(_playerRow.implicitWidth, parent.width - 16)
|
||||
height: 22
|
||||
contentWidth: _playerRow.implicitWidth
|
||||
clip: true
|
||||
Flow {
|
||||
id: _playerFlow
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: parent.width - 16
|
||||
spacing: 6
|
||||
|
||||
Row {
|
||||
id: _playerRow
|
||||
height: 22
|
||||
spacing: 6
|
||||
Repeater {
|
||||
model: root.players
|
||||
|
||||
Repeater {
|
||||
model: root.players
|
||||
delegate: Rectangle {
|
||||
required property var modelData
|
||||
required property int index
|
||||
|
||||
delegate: Rectangle {
|
||||
required property var modelData
|
||||
required property int index
|
||||
readonly property bool _active: index === root.playerIdx
|
||||
|
||||
readonly property bool _active: index === root.playerIdx
|
||||
width: _pLabel.implicitWidth + 12
|
||||
height: 18
|
||||
radius: 9
|
||||
color: _active ? S.Theme.base02 : (pHover.hovered ? S.Theme.base02 : "transparent")
|
||||
border.color: _active ? root.accentColor : S.Theme.base03
|
||||
border.width: _active ? 1 : 0
|
||||
|
||||
width: _pLabel.implicitWidth + 12
|
||||
height: 18
|
||||
radius: 9
|
||||
color: _active ? S.Theme.base02 : (pHover.hovered ? S.Theme.base02 : "transparent")
|
||||
border.color: _active ? root.accentColor : S.Theme.base03
|
||||
border.width: _active ? 1 : 0
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
Text {
|
||||
id: _pLabel
|
||||
anchors.centerIn: parent
|
||||
text: modelData.identity ?? "Player"
|
||||
color: _active ? root.accentColor : S.Theme.base04
|
||||
font.pixelSize: S.Theme.fontSize - 2
|
||||
font.family: S.Theme.fontFamily
|
||||
font.bold: _active
|
||||
}
|
||||
|
||||
Text {
|
||||
id: _pLabel
|
||||
anchors.centerIn: parent
|
||||
text: modelData.identity ?? "Player"
|
||||
color: _active ? root.accentColor : S.Theme.base04
|
||||
font.pixelSize: S.Theme.fontSize - 2
|
||||
font.family: S.Theme.fontFamily
|
||||
font.bold: _active
|
||||
}
|
||||
HoverHandler {
|
||||
id: pHover
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
id: pHover
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
|
||||
TapHandler {
|
||||
onTapped: {
|
||||
root.playerSwitched(index);
|
||||
}
|
||||
TapHandler {
|
||||
onTapped: {
|
||||
root.playerSwitched(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue