From 7e07c3980607d8c6e394520ea2e5ea37cb8860b7 Mon Sep 17 00:00:00 2001 From: lbartoletti Date: Tue, 22 Oct 2019 21:07:16 +0200 Subject: fontMetrics().width -> fontMetrics().horizontalAdvance --- src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp') diff --git a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp index 07b99f27..11db6f4d 100644 --- a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp +++ b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp @@ -30,7 +30,7 @@ PlainTextEditor::PlainTextEditor(QSettings *set, QWidget *parent) : QPlainTextEd hasChanges = readonly = false; lastSaveContents.clear(); matchleft = matchright = -1; - this->setTabStopWidth( 8 * this->fontMetrics().width(" ") ); //8 character spaces per tab (UNIX standard) + this->setTabStopWidth( 8 * this->fontMetrics().horizontalAdvance(" ") ); //8 character spaces per tab (UNIX standard) //this->setObjectName("PlainTextEditor"); //this->setStyleSheet("QPlainTextEdit#PlainTextEditor{ }"); SYNTAX = new Custom_Syntax(settings, this->document()); @@ -171,7 +171,7 @@ int PlainTextEditor::LNWWidth(){ //qDebug() << "point 1" << this->document()->defaultFont(); while(lines>=10){ chars++; lines/=10; } QFontMetrics metrics(this->document()->defaultFont()); - return (metrics.width("9")*chars); //make sure to add a tiny bit of padding + return (metrics.horizontalAdvance("9")*chars); //make sure to add a tiny bit of padding } void PlainTextEditor::paintLNW(QPaintEvent *ev){ -- cgit From 222502d67a66ad294412c786c1c9fffc46841e1f Mon Sep 17 00:00:00 2001 From: lbartoletti Date: Tue, 22 Oct 2019 21:25:50 +0200 Subject: fix setTabStopWidth -> setTabStopDistance --- src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp') diff --git a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp index 11db6f4d..0aedb1a0 100644 --- a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp +++ b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp @@ -30,7 +30,7 @@ PlainTextEditor::PlainTextEditor(QSettings *set, QWidget *parent) : QPlainTextEd hasChanges = readonly = false; lastSaveContents.clear(); matchleft = matchright = -1; - this->setTabStopWidth( 8 * this->fontMetrics().horizontalAdvance(" ") ); //8 character spaces per tab (UNIX standard) + this->setTabStopDistance( 8 * QFontMetricsF(this->font()).width(' ') ); //8 character spaces per tab (UNIX standard) //this->setObjectName("PlainTextEditor"); //this->setStyleSheet("QPlainTextEdit#PlainTextEditor{ }"); SYNTAX = new Custom_Syntax(settings, this->document()); -- cgit