Commit 24fc6185 authored by Leandro Melo's avatar Leandro Melo Committed by Eike Ziller
Browse files

Editor: Support floating point values for tab stop

Task-number: QTCREATORBUG-833

Change-Id: I76a4b69d6e9402f045a98712531475aff5e8d0ac
Reviewed-by: default avatarEike Ziller <>
parent 19ea22a2
......@@ -5482,8 +5482,13 @@ void BaseTextEditorWidget::setFontSettings(const TextEditor::FontSettings &fs)
void BaseTextEditorWidget::setTabSettings(const TabSettings &ts)
int charWidth = QFontMetrics(font()).width(QChar(' '));
setTabStopWidth(charWidth * ts.m_tabSize);
// Although the tab stop is stored as qreal the API from QPlainTextEdit only allows it
// to be set as an int. A work around is to access directly the QTextOption.
qreal charWidth = QFontMetricsF(font()).width(QChar(' '));
QTextOption option = document()->defaultTextOption();
option.setTabStop(charWidth * ts.m_tabSize);
void BaseTextEditorWidget::setDisplaySettings(const DisplaySettings &ds)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment