[vlc-commits] [Git][videolan/vlc][master] qml: determine resize handle width according to scroll bar width

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue May 7 03:30:22 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
010853ff by Fatih Uzunoglu at 2024-05-07T03:10:56+00:00
qml: determine resize handle width according to scroll bar width

Resize handle may overlap the scroll bar. In that case, using
scroll bar may be impossible because the resize handle might
have a width that is larger than the width of the scroll bar.

Since scroll bar is not customized, we have no control over
the width of the scroll bar. Therefore, in this patch it is
proposed to set the width of resize handle to half of the
scroll bar's width. This makes both scrolling and resizing
feasible.

- - - - -


2 changed files:

- modules/gui/qt/style/VLCStyle.qml
- modules/gui/qt/widgets/qml/HorizontalResizeHandle.qml


Changes:

=====================================
modules/gui/qt/style/VLCStyle.qml
=====================================
@@ -17,6 +17,7 @@
  *****************************************************************************/
 pragma Singleton
 import QtQuick
+import QtQuick.Controls
 import org.videolan.vlc 0.1
 
 QtObject {
@@ -55,6 +56,9 @@ QtObject {
     readonly property double margin_xlarge: MainCtx.dp(32, scale);
     readonly property double margin_xxlarge: MainCtx.dp(36, scale);
 
+    property Component _scrollBarComponent: ScrollBar { }
+    property real resizeHandleWidth
+
     // Borders
     readonly property int border: MainCtx.dp(1, scale)
     readonly property int focus_border: border
@@ -326,4 +330,16 @@ QtObject {
         return Math.floor((width + column_spacing) / (column_width + column_spacing))
     }
 
+    Component.onCompleted: {
+        {
+            // Resize handle width setting:
+            const scrollBarObject = _scrollBarComponent.createObject()
+            console.assert(scrollBarObject)
+            const scrollBarWidth = scrollBarObject.width
+            scrollBarObject.destroy()
+
+            _scrollBarComponent = null
+            resizeHandleWidth = (scrollBarWidth / 2)
+        }
+    }
 }


=====================================
modules/gui/qt/widgets/qml/HorizontalResizeHandle.qml
=====================================
@@ -39,7 +39,7 @@ MouseArea {
     property int _previousX
 
     cursorShape: Qt.SplitHCursor
-    width: VLCStyle.dp(8, VLCStyle.scale)
+    width: VLCStyle.resizeHandleWidth
     acceptedButtons: Qt.LeftButton
 
     onPressed: (mouse) => {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/010853ff241ac37d5ee9e88211899eb832251d9f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/010853ff241ac37d5ee9e88211899eb832251d9f
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