Fix Qt 5.13 deprecation warning about QFontMetrics::width()

Replace by QFontMetrics::horizontalAdvance(), fixing:
warning: ‘int QFontMetrics::width(const QString&, int) const’ is deprecated:
 Use QFontMetrics::horizontalAdvance [-Wdeprecated-declarations]

Change-Id: I9991ffefe6e87e872dc35ba291d562e06b28ca64
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Friedemann Kleint
2019-02-11 10:32:46 +01:00
committed by hjk
parent 6eac37a7d9
commit ec6b38dea0
39 changed files with 100 additions and 93 deletions

View File

@@ -2686,7 +2686,7 @@ void FakeVimHandler::Private::ensureCursorVisible()
void FakeVimHandler::Private::updateEditor()
{
const int charWidth = QFontMetrics(EDITOR(font())).width(' ');
const int charWidth = QFontMetrics(EDITOR(font())).horizontalAdvance(' ');
EDITOR(setTabStopWidth(charWidth * config(ConfigTabStop).toInt()));
setupCharClass();
}
@@ -2695,7 +2695,7 @@ void FakeVimHandler::Private::restoreWidget(int tabSize)
{
//EDITOR(removeEventFilter(q));
//EDITOR(setReadOnly(m_wasReadOnly));
const int charWidth = QFontMetrics(EDITOR(font())).width(' ');
const int charWidth = QFontMetrics(EDITOR(font())).horizontalAdvance(' ');
EDITOR(setTabStopWidth(charWidth * tabSize));
g.visualMode = NoVisualMode;
// Force "ordinary" cursor.