[multimedia/kasts] src/qml: Fix gaps in ChapterSlider

Bart De Vries <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit be340f41f165a5ad10a1ef90a8e3278f280d51c0 by Bart De Vries, on behalf of Tobias Fella.
Committed on 03/08/2026 at 08:22.
Pushed by bdevries into branch 'master'.

Fix gaps in ChapterSlider

Just set the relative width of the chapters and let the RowLayout figure out the rest. Makes the code nicer and ensures that the gaps have a consistent width

M  +3    -2    src/qml/ChapterSlider.qml

https://invent.kde.org/multimedia/kasts/-/commit/be340f41f165a5ad10a1ef90a8e3278f280d51c0

diff --git a/src/qml/ChapterSlider.qml b/src/qml/ChapterSlider.qml
index ce6ec108..fc337c7a 100644
--- a/src/qml/ChapterSlider.qml
+++ b/src/qml/ChapterSlider.qml
@@ -77,7 +77,7 @@ Control {
         anchors.fill: parent
         anchors.leftMargin: handle.width / 2
         anchors.rightMargin: handle.width / 2
-        spacing: 0
+        spacing: 1
         Repeater {
             id: chapters
             delegate: Rectangle {
@@ -90,7 +90,8 @@ Control {
                 // If we're not dragging, use the more precise method using the AudioManager. If we're dragging, this doesn't work because the AudioManager isn't updated while dragging
                 readonly property bool isCurrent: dragArea.drag.active ? (x - 1.01 <= handle.centerX && handle.centerX < x + width) : (start * 1000 <= AudioManager.position && (start + duration) * 1000 > AudioManager.position)
                 readonly property bool isPrevious: dragArea.drag.active ? (x + width < handle.centerX) : ((start + duration) * 1000 < AudioManager.position)
-                Layout.preferredWidth: duration * 1000 / root.duration * (layout.width - chapters.count + 1)
+                Layout.preferredWidth: duration
+                Layout.fillWidth: true
                 Layout.preferredHeight: root.grooveSize
                 Layout.alignment: Qt.AlignVCenter
                 radius: height / 2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.