From 8f872f1961115a580057c2a5c89fe7f0cb20e55d Mon Sep 17 00:00:00 2001 From: Jussi Kuokkanen Date: Mon, 31 Aug 2020 18:24:03 +0300 Subject: [PATCH] remove unused includes and use QRegularExpression --- src/TextInputWidget.cpp | 12 +++++------- src/TextInputWidget.h | 1 - 2 files changed, 5 insertions(+), 8 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 #include #include -#include -#include #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); diff --git a/src/TextInputWidget.h b/src/TextInputWidget.h index 6003551e..3aa05c39 100644 --- a/src/TextInputWidget.h +++ b/src/TextInputWidget.h @@ -17,7 +17,6 @@ #pragma once -#include #include #include