summary refs log tree commit diff
path: root/src/TextInputWidget.cpp
diff options
context:
space:
mode:
authorJussi Kuokkanen <jussi.kuokkanen@protonmail.com>2020-08-31 18:24:03 +0300
committerJussi Kuokkanen <jussi.kuokkanen@protonmail.com>2020-08-31 18:24:03 +0300
commit8f872f1961115a580057c2a5c89fe7f0cb20e55d (patch)
treeb9110fda28fa216c7704808649ee7efc26892b42 /src/TextInputWidget.cpp
parentremove comment (diff)
downloadnheko-8f872f1961115a580057c2a5c89fe7f0cb20e55d.tar.xz
remove unused includes and use QRegularExpression
Diffstat (limited to 'src/TextInputWidget.cpp')
-rw-r--r--src/TextInputWidget.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/TextInputWidget.cpp b/src/TextInputWidget.cpp

index ac76d5b0..6d57a5f1 100644 --- a/src/TextInputWidget.cpp +++ b/src/TextInputWidget.cpp
@@ -27,8 +27,6 @@ #include <QPainter> #include <QStyleOption> #include <QtConcurrent> -#include <qnamespace.h> -#include <qregexp.h> #include "Cache.h" #include "ChatPage.h" @@ -317,9 +315,9 @@ FilteredTextEdit::keyPressEvent(QKeyEvent *event) completer_->complete(completerRect()); } - if (emoji_popup_open_ && - (completer_->completionCount() < 1 || - !textAfterPosition(trigger_pos_).contains(QRegExp(":[^\r\n\t\f\v :]+$")))) { + if (emoji_popup_open_ && (completer_->completionCount() < 1 || + !textAfterPosition(trigger_pos_) + .contains(QRegularExpression(":[^\r\n\t\f\v :]+$")))) { // No completions for this word or another word than the completer was // started with emoji_popup_open_ = false; @@ -441,8 +439,8 @@ FilteredTextEdit::completerRect() // Move left edge to the beginning of the word auto cursor = textCursor(); auto rect = cursorRect(); - cursor.movePosition(QTextCursor::Left, QTextCursor::MoveAnchor, - textAfterPosition(trigger_pos_).length()); + cursor.movePosition( + QTextCursor::Left, QTextCursor::MoveAnchor, textAfterPosition(trigger_pos_).length()); auto cursor_global_x = viewport()->mapToGlobal(cursorRect(cursor).topLeft()).x(); auto rect_global_left = viewport()->mapToGlobal(rect.bottomLeft()).x(); auto dx = qAbs(rect_global_left - cursor_global_x);