Replaced QTimer with base::Timer in InputField.
This commit is contained in:
parent
6a7718ae96
commit
dfbf009904
2 changed files with 7 additions and 12 deletions
|
|
@ -1207,8 +1207,8 @@ InputField::InputField(
|
|||
|
||||
setAttribute(Qt::WA_AcceptTouchEvents);
|
||||
_inner->viewport()->setAttribute(Qt::WA_AcceptTouchEvents);
|
||||
_touchTimer.setSingleShot(true);
|
||||
connect(&_touchTimer, SIGNAL(timeout()), this, SLOT(onTouchTimer()));
|
||||
|
||||
_touchTimer.setCallback([=] { _touchRightButton = true; });
|
||||
|
||||
connect(_inner->document(), SIGNAL(contentsChange(int,int,int)), this, SLOT(onDocumentContentsChange(int,int,int)));
|
||||
connect(_inner.get(), SIGNAL(undoAvailable(bool)), this, SLOT(onUndoAvailable(bool)));
|
||||
|
|
@ -1322,10 +1322,6 @@ void InputField::updatePalette() {
|
|||
}
|
||||
}
|
||||
|
||||
void InputField::onTouchTimer() {
|
||||
_touchRightButton = true;
|
||||
}
|
||||
|
||||
void InputField::setExtendedContextMenu(
|
||||
rpl::producer<ExtendedContextMenu> value) {
|
||||
std::move(
|
||||
|
|
@ -1548,7 +1544,7 @@ void InputField::handleTouchEvent(QTouchEvent *e) {
|
|||
if (_touchPress || e->touchPoints().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
_touchTimer.start(QApplication::startDragTime());
|
||||
_touchTimer.callOnce(QApplication::startDragTime());
|
||||
_touchPress = true;
|
||||
_touchMove = _touchRightButton = false;
|
||||
_touchStart = e->touchPoints().cbegin()->screenPos().toPoint();
|
||||
|
|
@ -1566,7 +1562,7 @@ void InputField::handleTouchEvent(QTouchEvent *e) {
|
|||
|
||||
case QEvent::TouchCancel: {
|
||||
_touchPress = false;
|
||||
_touchTimer.stop();
|
||||
_touchTimer.cancel();
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1599,7 +1595,7 @@ void InputField::touchFinish() {
|
|||
}
|
||||
}
|
||||
if (weak) {
|
||||
_touchTimer.stop();
|
||||
_touchTimer.cancel();
|
||||
_touchPress
|
||||
= _touchMove
|
||||
= _touchRightButton
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
//
|
||||
#pragma once
|
||||
|
||||
#include "base/timer.h"
|
||||
#include "ui/emoji_config.h"
|
||||
#include "ui/rp_widget.h"
|
||||
#include "ui/effects/animations.h"
|
||||
|
|
@ -17,7 +18,6 @@
|
|||
#include <QtWidgets/QLineEdit>
|
||||
#include <QtWidgets/QTextEdit>
|
||||
#include <QtGui/QTextObjectInterface>
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
#include <rpl/variable.h>
|
||||
|
||||
|
|
@ -325,7 +325,6 @@ public:
|
|||
~InputField();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onTouchTimer();
|
||||
|
||||
void onDocumentContentsChange(int position, int charsRemoved, int charsAdded);
|
||||
void onCursorPositionChanged();
|
||||
|
|
@ -537,7 +536,7 @@ private:
|
|||
bool _focused = false;
|
||||
bool _error = false;
|
||||
|
||||
QTimer _touchTimer;
|
||||
base::Timer _touchTimer;
|
||||
bool _touchPress = false;
|
||||
bool _touchRightButton = false;
|
||||
bool _touchMove = false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue