From 9342a8b843e2fe924db09b2935464ac6d26adc27 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 1 Aug 2017 12:34:29 +0200 Subject: Add QTextOption/QTextEdit/QPlainTextEdit::tabStopDistance property In Qt, we have QTextOption::tabStop, QTextEdit::tabStopWidth and QPlainTextEdit::tabStopWidth. Neither are very good names, since the tab stop is neither a numerical value as in the former, nor does it have any dimensions that can be measured, as in the latter. Vertical text advances may also be supported by Qt at some point in the future, at which point the name would make even less sense. At the same time, we expose the actual type of the tab stop distance as floating point in the QTextEdit and QPlainTextEdit API instead of always rounding it to an int. To avoid duplicating either of these APIs in Qt Quick, we introduce tabStopDistance as the common term instead and deprecate the old names. [ChangeLog][Text] Introduced tabStopDistance property in QTextOption, QTextEdit and QPlainTextEdit as replacement for the inconsistently named tabStop and tabStopWidth properties. QTextOption::tabStop, QTextEdit::tabStopWidth and QPlainTextEdit::tabStopWidth have subsequently been deprecated. Change-Id: Ib7e01387910cddb58adaaaadcd56c0e69edc4bc2 Reviewed-by: Paolo Angelelli Reviewed-by: Lars Knoll --- src/gui/painting/qpainter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gui/painting/qpainter.cpp') diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index fb3c845e77..667c3b0fb5 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -7419,7 +7419,7 @@ void qt_format_text(const QFont &fnt, const QRectF &_r, if (option->flags() & QTextOption::IncludeTrailingSpaces) tf |= Qt::TextIncludeTrailingSpaces; - if (option->tabStop() >= 0 || !option->tabArray().isEmpty()) + if (option->tabStopDistance() >= 0 || !option->tabArray().isEmpty()) tf |= Qt::TextExpandTabs; } @@ -7536,8 +7536,8 @@ start_lengthVariant: engine.option = *option; } - if (engine.option.tabStop() < 0 && tabstops > 0) - engine.option.setTabStop(tabstops); + if (engine.option.tabStopDistance() < 0 && tabstops > 0) + engine.option.setTabStopDistance(tabstops); if (engine.option.tabs().isEmpty() && ta) { QList tabs; -- cgit v1.2.3