[vlc-commits] [Git][videolan/vlc][master] 2 commits: qml: improve weighted column calculation in TableViewExt

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Jan 11 11:58:30 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
fde069cd by Prince Gupta at 2025-01-11T11:44:30+00:00
qml: improve weighted column calculation in TableViewExt

- - - - -
9dd484b1 by Prince Gupta at 2025-01-11T11:44:30+00:00
qml: fix context button placement handling

- - - - -


3 changed files:

- modules/gui/qt/style/VLCStyle.qml
- modules/gui/qt/widgets/qml/TableViewDelegate.qml
- modules/gui/qt/widgets/qml/TableViewExt.qml


Changes:

=====================================
modules/gui/qt/style/VLCStyle.qml
=====================================
@@ -169,6 +169,9 @@ QtObject {
     readonly property int button_width_normal: MainCtx.dp(96, scale)
     readonly property int button_width_large: MainCtx.dp(128, scale)
 
+    readonly property int contextButton_width: icon_normal
+    readonly property int contextButton_margin: margin_xxsmall
+
     readonly property int checkButton_width: MainCtx.dp(56, scale)
     readonly property int checkButton_height: MainCtx.dp(32, scale)
 


=====================================
modules/gui/qt/widgets/qml/TableViewDelegate.qml
=====================================
@@ -244,19 +244,15 @@ T.Control {
         }
 
         Item {
-            width: VLCStyle.icon_normal
+            width: VLCStyle.contextButton_width
 
             height: parent.height
 
             Widgets.IconToolButton {
                 id: contextButton
 
-                anchors.right: parent.right
-
-                // NOTE: We want the contextButton to be contained inside the trailing
-                //       column_spacing.
-                anchors.rightMargin: delegate.leftPadding - VLCStyle.layout_left_margin + delegate.rightPadding - VLCStyle.layout_right_margin +
-                                     parent.width + contentItemRow.rightPadding
+                // place it at the end of the last column, we don't want spacing for this column
+                x: - contentItemRow.spacing + VLCStyle.contextButton_margin
 
                 anchors.verticalCenter: parent.verticalCenter
 


=====================================
modules/gui/qt/widgets/qml/TableViewExt.qml
=====================================
@@ -81,7 +81,7 @@ FocusScope {
          return count
       }
 
-    readonly property int _availableSpaceForWeightedColumns: (width - (leftMargin + rightMargin + _totalSpacerSize + _fixedColumnSize))
+    readonly property int _availableSpaceForWeightedColumns: (availableRowWidth - ( _totalSpacerSize + _fixedColumnSize))
     readonly property int _weightedColumnsSize: _availableSpaceForWeightedColumns / _totalColumnWeights
 
     readonly property int _totalSpacerSize: VLCStyle.column_spacing * sortModel.length
@@ -105,6 +105,8 @@ FocusScope {
     property real _availabeRowWidthLastUpdateTime: Date.now()
 
     readonly property real _currentAvailableRowWidth: width - leftMargin - rightMargin
+                                                      // contextButton is implemented as fixed column
+                                                      - VLCStyle.contextButton_width - (VLCStyle.contextButton_margin * 2)
 
     // Aliases
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3b56d2ab67f66374ac547d76e1418a6aa20882ed...9dd484b10d908b71b695ca3b29ce0d93a07bdbc8

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3b56d2ab67f66374ac547d76e1418a6aa20882ed...9dd484b10d908b71b695ca3b29ce0d93a07bdbc8
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