summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/codeeditor.cc15
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()