Skip to content

Commit

Permalink
determine width of linenumbers a bit better
Browse files Browse the repository at this point in the history
  • Loading branch information
JorisGoosen committed Sep 5, 2024
1 parent bc94421 commit 55eadf3
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions QMLComponents/components/JASP/Controls/TextArea.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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: "<i>%1.</i>".arg(index + 1)
font: jaspTheme.fontCode
color: jaspTheme.grayDarker
height: control.contentHeight / control.lineCount
anchors.right: parent.right
delegate: Text
{
text: "<i>%1</i>".arg(index + 1)
font: jaspTheme.fontCode
color: jaspTheme.grayDarker
height: control.contentHeight / control.lineCount
anchors.right: parent.right
anchors.rightMargin: jaspTheme.itemPadding / 2
}

onCountChanged: {
Expand Down

0 comments on commit 55eadf3

Please sign in to comment.