remove unused includes and use QRegularExpression
This commit is contained in:
parent
bb4636885d
commit
8f872f1961
@ -27,8 +27,6 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
#include <QtConcurrent>
|
#include <QtConcurrent>
|
||||||
#include <qnamespace.h>
|
|
||||||
#include <qregexp.h>
|
|
||||||
|
|
||||||
#include "Cache.h"
|
#include "Cache.h"
|
||||||
#include "ChatPage.h"
|
#include "ChatPage.h"
|
||||||
@ -317,9 +315,9 @@ FilteredTextEdit::keyPressEvent(QKeyEvent *event)
|
|||||||
completer_->complete(completerRect());
|
completer_->complete(completerRect());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (emoji_popup_open_ &&
|
if (emoji_popup_open_ && (completer_->completionCount() < 1 ||
|
||||||
(completer_->completionCount() < 1 ||
|
!textAfterPosition(trigger_pos_)
|
||||||
!textAfterPosition(trigger_pos_).contains(QRegExp(":[^\r\n\t\f\v :]+$")))) {
|
.contains(QRegularExpression(":[^\r\n\t\f\v :]+$")))) {
|
||||||
// No completions for this word or another word than the completer was
|
// No completions for this word or another word than the completer was
|
||||||
// started with
|
// started with
|
||||||
emoji_popup_open_ = false;
|
emoji_popup_open_ = false;
|
||||||
@ -441,8 +439,8 @@ FilteredTextEdit::completerRect()
|
|||||||
// Move left edge to the beginning of the word
|
// Move left edge to the beginning of the word
|
||||||
auto cursor = textCursor();
|
auto cursor = textCursor();
|
||||||
auto rect = cursorRect();
|
auto rect = cursorRect();
|
||||||
cursor.movePosition(QTextCursor::Left, QTextCursor::MoveAnchor,
|
cursor.movePosition(
|
||||||
textAfterPosition(trigger_pos_).length());
|
QTextCursor::Left, QTextCursor::MoveAnchor, textAfterPosition(trigger_pos_).length());
|
||||||
auto cursor_global_x = viewport()->mapToGlobal(cursorRect(cursor).topLeft()).x();
|
auto cursor_global_x = viewport()->mapToGlobal(cursorRect(cursor).topLeft()).x();
|
||||||
auto rect_global_left = viewport()->mapToGlobal(rect.bottomLeft()).x();
|
auto rect_global_left = viewport()->mapToGlobal(rect.bottomLeft()).x();
|
||||||
auto dx = qAbs(rect_global_left - cursor_global_x);
|
auto dx = qAbs(rect_global_left - cursor_global_x);
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user