diff options
author | hjk <hjk@qt.io> | 2019-03-04 11:48:02 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2019-03-04 14:04:37 +0000 |
commit | 475e7b12836b098ceb5990ddac2ac0c3427a9637 (patch) | |
tree | 730224a05c39f08032bb731adf87f8a0edf87ac9 /src/plugins/fakevim | |
parent | 014789d994b9ff53fc8fabffedccb44ad4f299b0 (diff) |
FakeVim: Fix a deprecation warning
... and re-organize surrounding code a bit.
Change-Id: I0c3af5b2a434c5088ed165fed97d562f468d16fc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/fakevim')
-rw-r--r-- | src/plugins/fakevim/fakevimhandler.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 72e12aeb53b..e808848de9b 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -2155,6 +2155,7 @@ public: bool handleExWriteCommand(const ExCommand &cmd); bool handleExEchoCommand(const ExCommand &cmd); + void setTabSize(int tabSize); void setupCharClass(); int charClass(QChar c, bool simple) const; signed char m_charClass[256]; @@ -2686,17 +2687,22 @@ void FakeVimHandler::Private::ensureCursorVisible() void FakeVimHandler::Private::updateEditor() { - const int charWidth = QFontMetrics(EDITOR(font())).horizontalAdvance(' '); - EDITOR(setTabStopWidth(charWidth * config(ConfigTabStop).toInt())); + setTabSize(config(ConfigTabStop).toInt()); setupCharClass(); } +void FakeVimHandler::Private::setTabSize(int tabSize) +{ + const int charWidth = QFontMetrics(EDITOR(font())).horizontalAdvance(' '); + const int width = charWidth * tabSize; + EDITOR(setTabStopDistance(width)); +} + void FakeVimHandler::Private::restoreWidget(int tabSize) { //EDITOR(removeEventFilter(q)); //EDITOR(setReadOnly(m_wasReadOnly)); - const int charWidth = QFontMetrics(EDITOR(font())).horizontalAdvance(' '); - EDITOR(setTabStopWidth(charWidth * tabSize)); + setTabSize(tabSize); g.visualMode = NoVisualMode; // Force "ordinary" cursor. setThinCursor(); |