[vlc-commits] [Git][videolan/vlc][master] 4 commits: qml: add missing implicit size setup in MusicArtistDelegate
Steve Lhomme (@robUx4)
gitlab at videolan.org
Sun Oct 29 09:18:30 UTC 2023
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
c24a0cb4 by Fatih Uzunoglu at 2023-10-29T08:59:00+00:00
qml: add missing implicit size setup in MusicArtistDelegate
- - - - -
c0eaa6ec by Fatih Uzunoglu at 2023-10-29T08:59:00+00:00
qml: properly place border rectangle in MusicArtistsAlbums.qml
- - - - -
7c672757 by Fatih Uzunoglu at 2023-10-29T08:59:00+00:00
qml: use RowLayout instead of Row in MusicArtistsAlbums.qml
- - - - -
647d53d9 by Fatih Uzunoglu at 2023-10-29T08:59:00+00:00
qml: refactor MusicArtistDelegate
This file does not behave like a proper control
before this patch.
- - - - -
2 changed files:
- modules/gui/qt/medialibrary/qml/MusicArtistDelegate.qml
- modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml
Changes:
=====================================
modules/gui/qt/medialibrary/qml/MusicArtistDelegate.qml
=====================================
@@ -51,7 +51,16 @@ T.ItemDelegate {
// Settings
- implicitHeight: VLCStyle.play_cover_small + (VLCStyle.margin_xsmall * 2)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
+
+ height: VLCStyle.play_cover_small + (VLCStyle.margin_xsmall * 2)
+
+ verticalPadding: VLCStyle.margin_xsmall
+ horizontalPadding: VLCStyle.margin_normal
Accessible.onPressAction: root.itemClicked()
@@ -62,7 +71,7 @@ T.ItemDelegate {
colorSet: ColorContext.Item
focused: root.activeFocus
- hovered: contentItem.containsMouse
+ hovered: root.hovered
enabled: root.enabled
}
@@ -72,10 +81,18 @@ T.ItemDelegate {
animate: theme.initialized
backgroundColor: root.isCurrent ? theme.bg.highlight : theme.bg.primary
activeBorderColor: theme.visualFocus
+
+ Widgets.CurrentIndicator {
+ length: parent.height - (margin * 2)
+
+ margin: VLCStyle.dp(2, VLCStyle.scale)
+
+ visible: isCurrent
+ }
}
- contentItem: MouseArea {
- hoverEnabled: true
+ MouseArea {
+ anchors.fill: parent
drag.axis: Drag.XAndYAxis
drag.smoothed: false
@@ -106,73 +123,62 @@ T.ItemDelegate {
onClicked: itemClicked(mouse)
onDoubleClicked: itemDoubleClicked(mouse)
+ }
- Widgets.CurrentIndicator {
- length: parent.height - (margin * 2)
-
- margin: VLCStyle.dp(4, VLCStyle.scale)
-
- visible: isCurrent
- }
-
- RowLayout {
- anchors.fill: parent
-
- anchors.leftMargin: VLCStyle.margin_normal
- anchors.rightMargin: VLCStyle.margin_normal
- anchors.topMargin: VLCStyle.margin_xsmall
- anchors.bottomMargin: VLCStyle.margin_xsmall
-
- spacing: VLCStyle.margin_xsmall
+ contentItem: RowLayout {
+ spacing: VLCStyle.margin_xsmall
- RoundImage {
- Layout.preferredWidth: VLCStyle.play_cover_small
- Layout.preferredHeight: Layout.preferredWidth
+ RoundImage {
+ implicitWidth: VLCStyle.play_cover_small
+ implicitHeight: VLCStyle.play_cover_small
+ Layout.fillHeight: true
+ Layout.preferredWidth: height
- radius: width
+ radius: width
- source: (model.cover) ? model.cover
- : VLCStyle.noArtArtistSmall
+ source: (model.cover) ? model.cover
+ : VLCStyle.noArtArtistSmall
- Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
+ Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
- Rectangle {
- anchors.fill: parent
+ Rectangle {
+ anchors.fill: parent
- radius: VLCStyle.play_cover_small
+ radius: VLCStyle.play_cover_small
- color: "transparent"
+ color: "transparent"
- border.width: VLCStyle.dp(1, VLCStyle.scale)
+ border.width: VLCStyle.dp(1, VLCStyle.scale)
- border.color: (isCurrent || _isHover) ? theme.accent
- : theme.border
- }
+ border.color: (isCurrent || _isHover) ? theme.accent
+ : theme.border
}
+ }
- Widgets.ScrollingText {
- label: artistName
-
- forceScroll: root.isCurrent || root._isHover
- clip: scrolling
+ Widgets.ScrollingText {
+ label: artistName
- Layout.fillWidth: true
- Layout.fillHeight: true
+ forceScroll: root.isCurrent || root._isHover
+ clip: scrolling
- Widgets.ListLabel {
- id: artistName
+ implicitHeight: artistName.implicitHeight
+ implicitWidth: artistName.implicitWidth
- anchors {
- verticalCenter: parent.verticalCenter
- }
+ Layout.fillWidth: true
+ Layout.fillHeight: true
- text: (model.name) ? model.name
- : I18n.qtr("Unknown artist")
+ Widgets.ListLabel {
+ id: artistName
- color: theme.fg.primary
+ anchors {
+ verticalCenter: parent.verticalCenter
}
- }
+ text: (model.name) ? model.name
+ : I18n.qtr("Unknown artist")
+
+ color: theme.fg.primary
+ }
}
}
}
=====================================
modules/gui/qt/medialibrary/qml/MusicArtistsAlbums.qml
=====================================
@@ -130,11 +130,13 @@ FocusScope {
focus: false
}
- Row {
+ RowLayout {
anchors.fill: parent
visible: artistModel.count > 0
+ spacing: 0
+
Widgets.KeyNavigableListView {
id: artistList
@@ -143,12 +145,12 @@ FocusScope {
selectionModel: root.selectionModel
currentIndex: -1
z: 1
- height: parent.height
- width: VLCStyle.isScreenSmall
- ? 0
- : Math.round(Helpers.clamp(root.width / resizeHandle.widthFactor,
- VLCStyle.colWidth(1) + VLCStyle.column_spacing,
- root.width * .5))
+ Layout.fillHeight: true
+ Layout.preferredWidth: VLCStyle.isScreenSmall
+ ? 0
+ : Math.round(Helpers.clamp(root.width / resizeHandle.widthFactor,
+ VLCStyle.colWidth(1) + VLCStyle.column_spacing,
+ root.width * .5))
visible: !VLCStyle.isScreenSmall && (artistModel.count > 0)
focus: !VLCStyle.isScreenSmall && (artistModel.count > 0)
@@ -189,7 +191,7 @@ FocusScope {
delegate: MusicArtistDelegate {
width: artistList.width
- leftPadding: root.leftPadding
+ leftPadding: rightPadding + root.leftPadding
isCurrent: ListView.isCurrentItem
@@ -212,18 +214,6 @@ FocusScope {
}
}
- Rectangle {
- // id: musicArtistLeftBorder
-
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- anchors.right: parent.right
-
- width: VLCStyle.border
- color: artistList.colorContext.separator
- }
-
-
Widgets.HorizontalResizeHandle {
id: resizeHandle
@@ -237,11 +227,18 @@ FocusScope {
}
}
+ Rectangle {
+ Layout.fillHeight: true
+
+ implicitWidth: VLCStyle.border
+ color: artistList.colorContext.separator
+ }
+
MusicArtist {
id: albumSubView
- height: parent.height
- width: root.width - root.leftPadding - artistList.width
+ Layout.fillHeight: true
+ Layout.fillWidth: true
rightPadding: root.rightPadding
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5e86108b065001b626eadbe87736eff5d8ef0d32...647d53d9d9f5fc19e59a6b48400144344a2dbb9b
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5e86108b065001b626eadbe87736eff5d8ef0d32...647d53d9d9f5fc19e59a6b48400144344a2dbb9b
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list