From 7c22cf3cc88a1f2f62d0cb8bc26f1e8f4c33c06f Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 30 Dec 2018 17:26:28 +0100 Subject: Set tab width in editor to 2 spaces. --- src/codeeditor.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/codeeditor.cc b/src/codeeditor.cc index 6d2dd2e..68c6a6a 100644 --- a/src/codeeditor.cc +++ b/src/codeeditor.cc @@ -48,16 +48,23 @@ CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent) lineNumberArea = new LineNumberArea(this); connect(this, SIGNAL(blockCountChanged(int)), - this, SLOT(updateLineNumberAreaWidth(int))); + this, SLOT(updateLineNumberAreaWidth(int))); connect(this, SIGNAL(updateRequest(QRect,int)), - this, SLOT(updateLineNumberArea(QRect,int))); + this, SLOT(updateLineNumberArea(QRect,int))); connect(this, SIGNAL(cursorPositionChanged()), - this, SLOT(highlightCurrentLine())); + this, SLOT(highlightCurrentLine())); - setStyleSheet("font: 12pt \"Courier\";"); + QFont font; + font.setFamily("Courier"); + font.setStyleHint(QFont::Monospace); + font.setFixedPitch(true); + font.setPointSize(12); + setFont(font); updateLineNumberAreaWidth(0); highlightCurrentLine(); + + setTabStopWidth(fontMetrics().width(" ")); } int CodeEditor::lineNumberAreaWidth() -- cgit v1.2.3