[vlc-commits] [Git][videolan/vlc][master] 2 commits: qml: avoid directly referencing root control's background item
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sun Dec 18 14:37:12 UTC 2022
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
eecd6014 by Fatih Uzunoglu at 2022-12-18T13:59:01+00:00
qml: avoid directly referencing root control's background item
- - - - -
dec5d4b6 by Fatih Uzunoglu at 2022-12-18T13:59:01+00:00
qml: avoid directly referencing root control's content item
- - - - -
15 changed files:
- modules/gui/qt/dialogs/dialogs/qml/CustomDialog.qml
- modules/gui/qt/dialogs/toolbar/qml/EditorDNDDelegate.qml
- modules/gui/qt/medialibrary/qml/MusicArtistDelegate.qml
- modules/gui/qt/network/qml/AddressbarButton.qml
- modules/gui/qt/player/qml/ControlBar.qml
- modules/gui/qt/player/qml/PlayerMenuItem.qml
- modules/gui/qt/player/qml/SliderBar.qml
- modules/gui/qt/player/qml/TracksMenu.qml
- modules/gui/qt/player/qml/controlbarcontrols/PlayButton.qml
- modules/gui/qt/player/qml/controlbarcontrols/RecordButton.qml
- modules/gui/qt/playlist/qml/PlaylistDelegate.qml
- modules/gui/qt/playlist/qml/PlaylistListView.qml
- modules/gui/qt/widgets/qml/GridItem.qml
- modules/gui/qt/widgets/qml/ImageToolButton.qml
- modules/gui/qt/widgets/qml/TableViewDelegate.qml
Changes:
=====================================
modules/gui/qt/dialogs/dialogs/qml/CustomDialog.qml
=====================================
@@ -26,7 +26,7 @@ import "qrc:///widgets/" as Widgets
ModalDialog {
id: root
- property alias text: content.text
+ property string text
property alias cancelTxt: cancelBtn.text
property alias okTxt: okBtn.text
@@ -65,11 +65,11 @@ ModalDialog {
}
contentItem: Text {
- id: content
focus: false
font.pixelSize: VLCStyle.fontSize_normal
color: VLCStyle.colors.text
wrapMode: Text.WordWrap
+ text: root.text
}
footer: FocusScope {
=====================================
modules/gui/qt/dialogs/toolbar/qml/EditorDNDDelegate.qml
=====================================
@@ -140,15 +140,13 @@ Control {
}
contentItem: Item {
- id: wrapper
-
implicitHeight: loader.implicitHeight
implicitWidth: loader.implicitWidth
Loader {
id: loader
- parent: Drag.active ? root : wrapper
+ parent: Drag.active ? root : control.contentItem
anchors.horizontalCenter: Drag.active ? undefined : parent.horizontalCenter
anchors.verticalCenter: Drag.active ? undefined : parent.verticalCenter
=====================================
modules/gui/qt/medialibrary/qml/MusicArtistDelegate.qml
=====================================
@@ -41,7 +41,7 @@ T.Control {
// Aliases
// Private
- property alias _isHover: mouseArea.containsMouse
+ readonly property bool _isHover: contentItem.containsMouse
// Signals
@@ -56,8 +56,6 @@ T.Control {
// Childs
background: Widgets.AnimatedBackground {
- id: background
-
active: visualFocus
backgroundColor: {
@@ -71,8 +69,6 @@ T.Control {
}
contentItem: MouseArea {
- id: mouseArea
-
hoverEnabled: true
drag.axis: Drag.XAndYAxis
@@ -175,7 +171,7 @@ T.Control {
text: (model.name) ? model.name
: I18n.qtr("Unknown artist")
- color: background.foregroundColor
+ color: root.background.foregroundColor
}
}
=====================================
modules/gui/qt/network/qml/AddressbarButton.qml
=====================================
@@ -33,8 +33,9 @@ T.AbstractButton {
// Aliases
- property alias foregroundColor: background.foregroundColor
- property alias backgroundColor: background.backgroundColor
+ property color foregroundColor: (hovered) ? VLCStyle.colors.buttonTextHover
+ : VLCStyle.colors.buttonBanner
+ property color backgroundColor: "transparent"
// Settings
@@ -53,14 +54,10 @@ T.AbstractButton {
// Children
background: Widgets.AnimatedBackground {
- id: background
-
active: visualFocus
- backgroundColor: "transparent"
-
- foregroundColor: (hovered) ? VLCStyle.colors.buttonTextHover
- : VLCStyle.colors.buttonBanner
+ backgroundColor: button.backgroundColor
+ foregroundColor: button.foregroundColor
}
contentItem: contentLoader.item
=====================================
modules/gui/qt/player/qml/ControlBar.qml
=====================================
@@ -114,8 +114,6 @@ Control {
}
contentItem: ColumnLayout {
- id: columnLayout
-
spacing: VLCStyle.margin_xsmall
z: 1
=====================================
modules/gui/qt/player/qml/PlayerMenuItem.qml
=====================================
@@ -37,7 +37,7 @@ T.MenuItem {
//implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
// implicitContentWidth + leftPadding + rightPadding)
- implicitHeight: contentId.implicitHeight + topPadding + bottomPadding
+ implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
padding: VLCStyle.margin_xsmall
spacing: VLCStyle.margin_xsmall
@@ -83,7 +83,6 @@ T.MenuItem {
}
contentItem: IconLabel {
- id: contentId
implicitHeight: VLCStyle.fontHeight_normal
readonly property real arrowPadding: control.subMenu && control.arrow ? control.arrow.width + control.spacing : 0
=====================================
modules/gui/qt/player/qml/SliderBar.qml
=====================================
@@ -153,7 +153,6 @@ Slider {
stepSize: 0.01
background: Item {
- id: slider
width: control.availableWidth
implicitHeight: control.implicitHeight
height: implicitHeight
=====================================
modules/gui/qt/player/qml/TracksMenu.qml
=====================================
@@ -60,8 +60,6 @@ T.Popup {
}
contentItem: StackView {
- id: view
-
focus: true
clip: true
=====================================
modules/gui/qt/player/qml/controlbarcontrols/PlayButton.qml
=====================================
@@ -163,8 +163,6 @@ T.Control {
}
contentItem: T.Label {
- id: contentLabel
-
text: {
var state = Player.playingState
=====================================
modules/gui/qt/player/qml/controlbarcontrols/RecordButton.qml
=====================================
@@ -35,8 +35,6 @@ Widgets.IconToolButton {
onClicked: Player.toggleRecord()
contentItem: T.Label {
- id: content
-
anchors.centerIn: parent
verticalAlignment: Text.AlignVCenter
@@ -55,7 +53,7 @@ Widgets.IconToolButton {
running: control.enabled && Player.recording
onStopped: {
- content.color = control.color
+ control.contentItem.color = control.color
}
}
=====================================
modules/gui/qt/playlist/qml/PlaylistDelegate.qml
=====================================
@@ -95,8 +95,6 @@ T.Control {
}
contentItem: RowLayout {
- id: content
-
spacing: 0
Item {
=====================================
modules/gui/qt/playlist/qml/PlaylistListView.qml
=====================================
@@ -33,7 +33,7 @@ Control {
property alias model: listView.model
- property alias useAcrylic: acrylicBackground.enabled
+ property bool useAcrylic: true
readonly property real minimumWidth: noContentInfoColumn.implicitWidth +
leftPadding +
@@ -178,8 +178,7 @@ Control {
}
background: Widgets.AcrylicBackground {
- id: acrylicBackground
-
+ enabled: root.useAcrylic
alternativeColor: colors.bgAlt
}
=====================================
modules/gui/qt/widgets/qml/GridItem.qml
=====================================
@@ -37,7 +37,7 @@ T.Control {
property int titleMargin: VLCStyle.margin_xsmall
property Item dragItem: null
- readonly property bool highlighted: (mouseArea.containsMouse || visualFocus)
+ readonly property bool highlighted: (contentItem.containsMouse || visualFocus)
readonly property int selectedBorderWidth: VLCStyle.gridItemSelectedBorder
@@ -150,8 +150,6 @@ T.Control {
// Childs
background: AnimatedBackground {
- id: background
-
width: root.width + (selectedBorderWidth * 2)
height: root.height + (selectedBorderWidth * 2)
@@ -164,12 +162,10 @@ T.Control {
? VLCStyle.colors.gridSelect
: VLCStyle.colors.setColorAlpha(VLCStyle.colors.gridSelect, 0)
- visible: animationRunning || background.active || root.selected
+ visible: animationRunning || active || root.selected
}
contentItem: MouseArea {
- id: mouseArea
-
implicitWidth: layout.implicitWidth
implicitHeight: layout.implicitHeight
@@ -301,7 +297,7 @@ T.Control {
id: titleLabel
height: implicitHeight
- color: background.foregroundColor
+ color: root.background.foregroundColor
textFormat: Text.PlainText
}
}
@@ -312,7 +308,7 @@ T.Control {
visible: text !== ""
text: root.subtitle
elide: Text.ElideRight
- color: background.foregroundColor
+ color: root.background.foregroundColor
textFormat: Text.PlainText
Layout.preferredWidth: Math.min(pictureWidth, implicitWidth)
=====================================
modules/gui/qt/widgets/qml/ImageToolButton.qml
=====================================
@@ -40,7 +40,7 @@ T.ToolButton {
property color colorHover: VLCStyle.colors.buttonTextHover
property color colorHighlighted: VLCStyle.colors.accent
property color colorDisabled: paintOnly ? color : VLCStyle.colors.textInactive
- property alias colorFocus: background.activeBorderColor
+ property color colorFocus: VLCStyle.colors.bgFocus
padding: 0
@@ -56,8 +56,6 @@ T.ToolButton {
Keys.onPressed: Navigation.defaultKeyAction(event)
background: AnimatedBackground {
- id: background
-
width: control.sourceSize.width
height: control.sourceSize.height
@@ -84,7 +82,7 @@ T.ToolButton {
return control.color;
}
- activeBorderColor: VLCStyle.colors.bgFocus
+ activeBorderColor: control.colorFocus
}
contentItem: Image {
=====================================
modules/gui/qt/widgets/qml/TableViewDelegate.qml
=====================================
@@ -88,8 +88,6 @@ T.Control {
// Childs
background: AnimatedBackground {
- id: background
-
active: visualFocus
animationDuration: VLCStyle.duration_short
@@ -161,7 +159,8 @@ T.Control {
}
contentItem: Row {
- id: content
+ leftPadding: VLCStyle.margin_xxxsmall
+ rightPadding: VLCStyle.margin_xxxsmall
spacing: VLCStyle.column_spacing
@@ -179,7 +178,7 @@ T.Control {
readonly property bool containsMouse: hoverArea.containsMouse
- readonly property color foregroundColor: background.foregroundColor
+ readonly property color foregroundColor: delegate.background.foregroundColor
width: (modelData.width) ? modelData.width : 0
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/00d070eda148b49678cea9598bc0b6b166965a77...dec5d4b686c552ad5a6be53b930d5f607fb9409b
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/00d070eda148b49678cea9598bc0b6b166965a77...dec5d4b686c552ad5a6be53b930d5f607fb9409b
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