[vlc-commits] [Git][videolan/vlc][master] 3 commits: qml: optimze valid item checking in ExpandGridView

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Mon May 23 14:19:15 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
10f0c0f4 by Prince Gupta at 2022-05-23T13:56:17+00:00
qml: optimze valid item checking in ExpandGridView

_containsItem is called a lot, cache the global variable lookup by caching it

- - - - -
e9bccf6c by Prince Gupta at 2022-05-23T13:56:17+00:00
qml: only allow plain text in GridItem

improves recyling time in ExpandGridView

- - - - -
36f24898 by Prince Gupta at 2022-05-23T13:56:17+00:00
qml: optimize tooltip visibility checking in GridItem

bear cost of instantiating an extra element to save unnecessary binding
triggers

previous implementation used existing MouseArea coverring whole GridItem
to check for ToolTip visibility for subtitle text, but that cause a lot
of unnecessary binding evaluation on every mouse move

- - - - -


2 changed files:

- modules/gui/qt/widgets/qml/ExpandGridView.qml
- modules/gui/qt/widgets/qml/GridItem.qml


Changes:

=====================================
modules/gui/qt/widgets/qml/ExpandGridView.qml
=====================================
@@ -458,7 +458,8 @@ FocusScope {
 
     function _containsItem(id) {
         var i = id - _currentRange[0]
-        return i >= 0 && i < _idChildrenList.length && typeof _idChildrenList[i] !== "undefined"
+        var childrenList = _idChildrenList
+        return i >= 0 && i < childrenList.length && typeof childrenList[i] !== "undefined"
     }
 
     function _repositionItem(id, x, y) {


=====================================
modules/gui/qt/widgets/qml/GridItem.qml
=====================================
@@ -282,6 +282,7 @@ T.Control {
 
                     height: implicitHeight
                     color: background.foregroundColor
+                    textFormat: Text.PlainText
                 }
             }
 
@@ -292,6 +293,7 @@ T.Control {
                 text: root.subtitle
                 elide: Text.ElideRight
                 color: background.foregroundColor
+                textFormat: Text.PlainText
 
                 Layout.preferredWidth: Math.min(pictureWidth, implicitWidth)
                 Layout.alignment: root.textAlignHCenter ? Qt.AlignCenter : Qt.AlignLeft
@@ -303,12 +305,13 @@ T.Control {
 
                 ToolTip.delay: VLCStyle.delayToolTipAppear
                 ToolTip.text: subtitleTxt.text
-                ToolTip.visible: {
-                    if (!mouseArea.containsMouse)
-                        return false
+                ToolTip.visible: subtitleTxtMouseArea.containsMouse
 
-                    var pos = mouseArea.mapToItem(subtitleTxt, mouseArea.mouseX, mouseArea.mouseY)
-                    return Helpers.contains(Qt.rect(0, 0, width, height), pos)
+                MouseArea {
+                    id: subtitleTxtMouseArea
+
+                    anchors.fill: parent
+                    hoverEnabled: true
                 }
             }
         }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1fda1d1af3d64ae0fba52f40c8529529566b31c1...36f248985db31e1ce800f7cbde4f735239e63c95

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1fda1d1af3d64ae0fba52f40c8529529566b31c1...36f248985db31e1ce800f7cbde4f735239e63c95
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