From 55eadf3369e11ff3a754275df1130b8b5eb3ab30 Mon Sep 17 00:00:00 2001 From: Joris Goosen Date: Thu, 5 Sep 2024 14:24:32 +0200 Subject: [PATCH] determine width of linenumbers a bit better --- .../components/JASP/Controls/TextArea.qml | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/QMLComponents/components/JASP/Controls/TextArea.qml b/QMLComponents/components/JASP/Controls/TextArea.qml index 61a628fff4..6ecab8ec50 100644 --- a/QMLComponents/components/JASP/Controls/TextArea.qml +++ b/QMLComponents/components/JASP/Controls/TextArea.qml @@ -98,19 +98,27 @@ TextAreaBase width: lineNumbersRect.visible ? lineNumbers.width : 0 height: Math.max(flickableRectangle.height, control.contentHeight) + 10 color: "transparent" + + FontMetrics + { + font: jaspTheme.fontCode + id: lineNumberWidthDeterminer + } ListView { id: lineNumbers - width: contentItem.childrenRect.width + width: lineNumberWidthDeterminer.advanceWidth(control.lineCount) + jaspTheme.itemPadding height: parent.height model: control.lineCount - delegate: Text { - text: "%1.".arg(index + 1) - font: jaspTheme.fontCode - color: jaspTheme.grayDarker - height: control.contentHeight / control.lineCount - anchors.right: parent.right + delegate: Text + { + text: "%1".arg(index + 1) + font: jaspTheme.fontCode + color: jaspTheme.grayDarker + height: control.contentHeight / control.lineCount + anchors.right: parent.right + anchors.rightMargin: jaspTheme.itemPadding / 2 } onCountChanged: {