fix width issue

This commit is contained in:
Benjamin Palko 2025-07-22 09:13:43 -04:00
parent e75c86e056
commit 00a46ac6ec
2 changed files with 9 additions and 6 deletions

View file

@ -6,9 +6,9 @@ Item {
id: root id: root
property int currentIndex: 0 property int currentIndex: 0
property var players: Mpris.players
implicitWidth: childrenRect.width anchors.horizontalCenter: parent.horizontalCenter
implicitHeight: childrenRect.height
Repeater { Repeater {
id: players id: players
@ -16,6 +16,9 @@ Item {
Player { Player {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
visible: index === root.currentIndex && modelData.canControl visible: index === root.currentIndex && modelData.canControl
onNextPlayer: { onNextPlayer: {

View file

@ -11,15 +11,15 @@ Item {
signal nextPlayer signal nextPlayer
signal previousPlayer signal previousPlayer
anchors.horizontalCenter: parent.horizontalCenter implicitWidth: text.width
implicitWidth: childrenRect.width
implicitHeight: Dimensions.mpris.height implicitHeight: Dimensions.mpris.height
StyledLabel { StyledLabel {
anchors.fill: parent anchors.fill: text
} }
StyledText { StyledText {
id: text
text: `${modelData.isPlaying ? "" : ""} ${modelData.trackTitle} - ${modelData.trackArtist}` text: `${modelData.isPlaying ? "" : ""} ${modelData.trackTitle} - ${modelData.trackArtist}`
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
@ -32,7 +32,7 @@ Item {
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: text
onClicked: { onClicked: {
if (!modelData.canTogglePlaying) { if (!modelData.canTogglePlaying) {