[vlc-commits] [Git][videolan/vlc][master] 8 commits: qml: fix binding loop in PlaylistListView

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Nov 5 09:46:40 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
6a420c1b by Fatih Uzunoglu at 2022-11-05T09:22:49+00:00
qml: fix binding loop in PlaylistListView

- - - - -
8b875e4e by Fatih Uzunoglu at 2022-11-05T09:22:49+00:00
qml: fix binding loop in EditorDNDView

- - - - -
a4691f31 by Fatih Uzunoglu at 2022-11-05T09:22:49+00:00
qml: fix binding loop in PlayButton

- - - - -
89c19200 by Fatih Uzunoglu at 2022-11-05T09:22:49+00:00
qml: fix TypeError due to null read in IconToolButton

- - - - -
ae8835dc by Fatih Uzunoglu at 2022-11-05T09:22:49+00:00
qml: fix invalid alias in IconToolButton

- - - - -
b042f78c by Fatih Uzunoglu at 2022-11-05T09:22:49+00:00
qml: fix binding loop in MainInterface

- - - - -
facadb54 by Fatih Uzunoglu at 2022-11-05T09:22:49+00:00
qml: fix binding loops in Player

- - - - -
939ea2c4 by Fatih Uzunoglu at 2022-11-05T09:22:49+00:00
qml: fix TypeError due to null read in KeyNavigableTableView

- - - - -


7 changed files:

- modules/gui/qt/dialogs/toolbar/qml/EditorDNDView.qml
- modules/gui/qt/maininterface/qml/MainInterface.qml
- modules/gui/qt/player/qml/Player.qml
- modules/gui/qt/player/qml/controlbarcontrols/PlayButton.qml
- modules/gui/qt/playlist/qml/PlaylistListView.qml
- modules/gui/qt/widgets/qml/IconToolButton.qml
- modules/gui/qt/widgets/qml/KeyNavigableTableView.qml


Changes:

=====================================
modules/gui/qt/dialogs/toolbar/qml/EditorDNDView.qml
=====================================
@@ -115,7 +115,11 @@ ListView {
         anchors.verticalCenter: parent.verticalCenter
 
         implicitHeight: VLCStyle.icon_medium
-        implicitWidth: Math.max(implicitHeight, playerBtnDND.width - x)
+
+        BindingCompat on implicitWidth {
+            delayed: true
+            value: Math.max(implicitHeight, playerBtnDND.width - x)
+        }
 
         property alias dropVisible: footerDropArea.containsDrag
 


=====================================
modules/gui/qt/maininterface/qml/MainInterface.qml
=====================================
@@ -49,13 +49,10 @@ Item {
         value: root.height
     }
 
-    BindingCompat {
-        target: root.Window.window
-        property: "color"
-        value: VLCStyle.colors.bg
-        when: root.Window.window &&
-              !Qt.colorEqual(root.Window.window.color,
-                             "transparent")
+    Window.onWindowChanged: {
+        if (Window.window && !Qt.colorEqual(Window.window.color, "transparent")) {
+            Window.window.color = Qt.binding(function() { return VLCStyle.colors.bg })
+        }
     }
 
     Widgets.ToolTipExt {


=====================================
modules/gui/qt/player/qml/Player.qml
=====================================
@@ -23,6 +23,7 @@ import QtGraphicalEffects 1.0
 import QtQuick.Window 2.11
 
 import org.videolan.vlc 0.1
+import org.videolan.compat 0.1
 
 import "qrc:///style/"
 import "qrc:///widgets/" as Widgets
@@ -430,7 +431,11 @@ FocusScope {
                 Layout.alignment: Qt.AlignHCenter
                 Layout.topMargin: VLCStyle.margin_xxlarge
 
-                visible: centerContent.height > (albumLabel.y + albumLabel.height)
+                BindingCompat on visible {
+                    delayed: true
+                    value: centerContent.height > (albumLabel.y + albumLabel.height)
+                }
+
                 text: mainPlaylistController.currentItem.album
                 font.pixelSize: VLCStyle.fontSize_xxlarge
                 horizontalAlignment: Text.AlignHCenter
@@ -444,7 +449,11 @@ FocusScope {
                 Layout.alignment: Qt.AlignHCenter
                 Layout.topMargin: VLCStyle.margin_small
 
-                visible: centerContent.height > (artistLabel.y + artistLabel.height)
+                BindingCompat on visible {
+                    delayed: true
+                    value: centerContent.height > (artistLabel.y + artistLabel.height)
+                }
+
                 text: mainPlaylistController.currentItem.artist
                 font.weight: Font.Light
                 horizontalAlignment: Text.AlignHCenter
@@ -458,7 +467,11 @@ FocusScope {
                 Layout.alignment: Qt.AlignHCenter
                 Layout.topMargin: VLCStyle.margin_large
 
-                visible: Player.videoTracks.count === 0 && centerContent.height > (audioControls.y + audioControls.height)
+                BindingCompat on visible {
+                    delayed: true
+                    value: Player.videoTracks.count === 0 && centerContent.height > (audioControls.y + audioControls.height)
+                }
+
                 focus: visible
                 spacing: VLCStyle.margin_xxsmall
                 Navigation.parentItem: rootPlayer


=====================================
modules/gui/qt/player/qml/controlbarcontrols/PlayButton.qml
=====================================
@@ -91,11 +91,6 @@ T.Control {
             if (!containsMouse)
                 return false
 
-            if (width !== height) {
-                console.warn("PlayButton should be round!")
-                return true
-            }
-
             var center = (width / 2)
             if (Helpers.pointInRadius( center - mouseX,
                                        center - mouseY,
@@ -216,10 +211,10 @@ T.Control {
 
             color: Qt.rgba(255 / 255, 97 / 255, 10 / 255, 0.29)
 
-            xRadius: sourceSize.width
+            xRadius: parent.width
             yRadius: xRadius
 
-            sourceSize: Qt.size(parent.width, parent.height)
+            sourceSize: Qt.size(xRadius, yRadius)
         }
 
         Widgets.DropShadowImage {
@@ -235,10 +230,10 @@ T.Control {
 
             color: Qt.rgba(255 / 255, 97 / 255, 10 / 255, 1.0)
 
-            xRadius: sourceSize.width
+            xRadius: parent.width
             yRadius: xRadius
 
-            sourceSize: Qt.size(parent.width, parent.height)
+            sourceSize: Qt.size(xRadius, yRadius)
         }
 
         Widgets.ScaledImage {


=====================================
modules/gui/qt/playlist/qml/PlaylistListView.qml
=====================================
@@ -22,6 +22,7 @@ import QtQuick.Layouts 1.11
 import QtQml.Models 2.2
 
 import org.videolan.vlc 0.1
+import org.videolan.compat 0.1
 
 import "qrc:///widgets/" as Widgets
 import "qrc:///util/Helpers.js" as Helpers
@@ -309,8 +310,12 @@ Control {
             }
 
             footer: Item {
-                width: parent.width
-                height: Math.max(VLCStyle.icon_normal, listView.height - y)
+                implicitWidth: parent.width
+
+                BindingCompat on implicitHeight {
+                    delayed: true
+                    value: Math.max(VLCStyle.icon_normal, listView.height - y)
+                }
 
                 property alias firstItemIndicatorVisible: firstItemIndicator.visible
 


=====================================
modules/gui/qt/widgets/qml/IconToolButton.qml
=====================================
@@ -52,7 +52,7 @@ T.ToolButton {
 
 
     // active border color
-    property alias colorFocus: background.activeBorderColor
+    property color colorFocus: VLCStyle.colors.bgFocus
 
     // Settings
 
@@ -60,10 +60,10 @@ T.ToolButton {
 
     enabled: !paintOnly
 
-    implicitWidth: Math.max(background.implicitWidth,
+    implicitWidth: Math.max(background ? background.implicitWidth : 0,
                             contentItem.implicitWidth + leftPadding + rightPadding)
-    implicitHeight: Math.max(background.implicitHeight,
-                            contentItem.implicitHeight + topPadding + bottomPadding)
+    implicitHeight: Math.max(background ? background.implicitHeight : 0,
+                             contentItem.implicitHeight + topPadding + bottomPadding)
     baselineOffset: contentItem.y + contentItem.baselineOffset
 
     // Keys
@@ -78,8 +78,6 @@ T.ToolButton {
     T.ToolTip.delay: VLCStyle.delayToolTipAppear
 
     background: AnimatedBackground {
-        id: background
-
         implicitWidth: size
         implicitHeight: size
 
@@ -106,7 +104,7 @@ T.ToolButton {
                 return control.color;
         }
 
-        activeBorderColor: VLCStyle.colors.bgFocus
+        activeBorderColor: control.colorFocus
     }
 
     contentItem: T.Label {
@@ -117,7 +115,7 @@ T.ToolButton {
 
         text: iconText
 
-        color: background.foregroundColor
+        color: background ? background.foregroundColor : control.color
 
         font.pixelSize: control.size
         font.family: VLCIcons.fontFamily
@@ -135,7 +133,7 @@ T.ToolButton {
 
             text: VLCIcons.active_indicator
 
-            color: background.foregroundColor
+            color: background ? background.foregroundColor : control.color
 
             font.pixelSize: control.size
             font.family: VLCIcons.fontFamily


=====================================
modules/gui/qt/widgets/qml/KeyNavigableTableView.qml
=====================================
@@ -48,7 +48,7 @@ FocusScope {
     }
 
     property Component header: Item{}
-    property Item headerItem: view.headerItem.loadedHeader
+    property Item headerItem: view.headerItem ? view.headerItem.loadedHeader : null
     property color headerColor
     property int headerTopPadding: 0
 
@@ -333,7 +333,7 @@ FocusScope {
         }
 
         section.delegate: Widgets.ListLabel {
-            x: view.headerItem.contentX - VLCStyle.table_section_width
+            x: (view.headerItem ? view.headerItem.contentX : 0) - VLCStyle.table_section_width
             topPadding: VLCStyle.margin_xsmall
             bottomPadding: VLCStyle.margin_xxsmall
             leftPadding: VLCStyle.table_section_text_margin



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d136a63eac85315937fd6437b787bcba50e1962f...939ea2c47f28163d8d09f7a9138e8aead9377984

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d136a63eac85315937fd6437b787bcba50e1962f...939ea2c47f28163d8d09f7a9138e8aead9377984
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