Skip to content

Commit

Permalink
qml: avoid directly referencing root control's content item
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzun authored and jbkempf committed Dec 18, 2022
1 parent eecd601 commit dec5d4b
Show file tree
Hide file tree
Showing 11 changed files with 9 additions and 25 deletions.
4 changes: 2 additions & 2 deletions modules/gui/qt/dialogs/dialogs/qml/CustomDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions modules/gui/qt/dialogs/toolbar/qml/EditorDNDDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions modules/gui/qt/medialibrary/qml/MusicArtistDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ T.Control {
// Aliases
// Private

property alias _isHover: mouseArea.containsMouse
readonly property bool _isHover: contentItem.containsMouse

// Signals

Expand Down Expand Up @@ -69,8 +69,6 @@ T.Control {
}

contentItem: MouseArea {
id: mouseArea

hoverEnabled: true

drag.axis: Drag.XAndYAxis
Expand Down
2 changes: 0 additions & 2 deletions modules/gui/qt/player/qml/ControlBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ Control {
}

contentItem: ColumnLayout {
id: columnLayout

spacing: VLCStyle.margin_xsmall
z: 1

Expand Down
3 changes: 1 addition & 2 deletions modules/gui/qt/player/qml/PlayerMenuItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions modules/gui/qt/player/qml/TracksMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ T.Popup {
}

contentItem: StackView {
id: view

focus: true
clip: true

Expand Down
2 changes: 0 additions & 2 deletions modules/gui/qt/player/qml/controlbarcontrols/PlayButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ T.Control {
}

contentItem: T.Label {
id: contentLabel

text: {
var state = Player.playingState

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ Widgets.IconToolButton {
onClicked: Player.toggleRecord()

contentItem: T.Label {
id: content

anchors.centerIn: parent

verticalAlignment: Text.AlignVCenter
Expand All @@ -55,7 +53,7 @@ Widgets.IconToolButton {
running: control.enabled && Player.recording

onStopped: {
content.color = control.color
control.contentItem.color = control.color
}
}

Expand Down
2 changes: 0 additions & 2 deletions modules/gui/qt/playlist/qml/PlaylistDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ T.Control {
}

contentItem: RowLayout {
id: content

spacing: 0

Item {
Expand Down
4 changes: 1 addition & 3 deletions modules/gui/qt/widgets/qml/GridItem.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -166,8 +166,6 @@ T.Control {
}

contentItem: MouseArea {
id: mouseArea

implicitWidth: layout.implicitWidth
implicitHeight: layout.implicitHeight

Expand Down
3 changes: 2 additions & 1 deletion modules/gui/qt/widgets/qml/TableViewDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ T.Control {
}

contentItem: Row {
id: content
leftPadding: VLCStyle.margin_xxxsmall
rightPadding: VLCStyle.margin_xxxsmall

spacing: VLCStyle.column_spacing

Expand Down

0 comments on commit dec5d4b

Please sign in to comment.