Merge branch 'qml/resizehandlewidth' into 'master'

qml: determine resize handle width according to scroll bar width

See merge request videolan/vlc!5056
This commit is contained in:
Fatih Uzunoğlu 2024-05-07 03:11:07 +00:00
commit d80a3f188f
2 changed files with 17 additions and 1 deletions

View File

@ -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)
}
}
}

View File

@ -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) => {