Fix monospace font

This commit is contained in:
Petr Mironychev
2024-10-14 21:25:18 +02:00
parent 1dd50b6c83
commit 95f29fefc7
2 changed files with 15 additions and 2 deletions

View File

@ -28,6 +28,19 @@ Rectangle {
property string language: ""
property color selectionColor
readonly property string monospaceFont: {
switch (Qt.platform.os) {
case "windows":
return "Consolas";
case "osx":
return "Menlo";
case "linux":
return "DejaVu Sans Mono";
default:
return "monospace";
}
}
border.color: root.color.hslLightness > 0.5 ? Qt.darker(root.color, 1.3)
: Qt.lighter(root.color, 1.3)
border.width: 2
@ -48,7 +61,8 @@ Rectangle {
text: root.code
readOnly: true
selectByMouse: true
font.family: "monospace"
font.family: monospaceFont
font.pointSize: 12
color: parent.color.hslLightness > 0.5 ? "black" : "white"
wrapMode: Text.WordWrap
selectionColor: root.selectionColor