diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-12-30 17:26:28 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-12-30 17:26:28 +0100 |
commit | 7c22cf3cc88a1f2f62d0cb8bc26f1e8f4c33c06f (patch) | |
tree | 4e818d127cce4d5347ad6159e64a03320d27d867 | |
parent | 6f2c3b90ce29a20e14cc769841056d4b36c42d50 (diff) |
Set tab width in editor to 2 spaces.
-rw-r--r-- | src/codeeditor.cc | 15 |
1 files 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() |