mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-11 11:47:09 +02:00
Add the same enter/leave check to ListWidget.
This commit is contained in:
parent
7c710e22cc
commit
b6a31979f2
2 changed files with 9 additions and 0 deletions
|
@ -2954,6 +2954,7 @@ void ListWidget::mousePressEvent(QMouseEvent *e) {
|
|||
e->accept();
|
||||
return; // ignore mouse press, that was hiding context menu
|
||||
}
|
||||
_mouseActive = true;
|
||||
mouseActionStart(e->globalPos(), e->button());
|
||||
}
|
||||
|
||||
|
@ -3161,6 +3162,7 @@ void ListWidget::mouseMoveEvent(QMouseEvent *e) {
|
|||
mouseReleaseEvent(e);
|
||||
}
|
||||
if (reallyMoved) {
|
||||
_mouseActive = true;
|
||||
lastGlobalPosition = e->globalPos();
|
||||
if (!buttonsPressed
|
||||
|| (_scrollDateLink
|
||||
|
@ -3191,6 +3193,7 @@ rpl::producer<bool> ListWidget::touchMaybeSelectingValue() const {
|
|||
}
|
||||
|
||||
void ListWidget::enterEventHook(QEnterEvent *e) {
|
||||
_mouseActive = true;
|
||||
mouseActionUpdate(QCursor::pos());
|
||||
return TWidget::enterEventHook(e);
|
||||
}
|
||||
|
@ -3211,6 +3214,7 @@ void ListWidget::leaveEventHook(QEvent *e) {
|
|||
_cursor = style::cur_default;
|
||||
setCursor(_cursor);
|
||||
}
|
||||
_mouseActive = false;
|
||||
return TWidget::leaveEventHook(e);
|
||||
}
|
||||
|
||||
|
@ -3643,6 +3647,10 @@ int ListWidget::SelectionViewOffset(
|
|||
|
||||
|
||||
void ListWidget::mouseActionUpdate() {
|
||||
if (!_mouseActive && !window()->isActiveWindow()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto mousePosition = mapFromGlobal(_mousePosition);
|
||||
auto point = QPoint(
|
||||
std::clamp(mousePosition.x(), 0, width()),
|
||||
|
|
|
@ -816,6 +816,7 @@ private:
|
|||
uint16 _mouseTextSymbol = 0;
|
||||
bool _pressWasInactive = false;
|
||||
bool _overSenderUserpic = false;
|
||||
bool _mouseActive = false;
|
||||
|
||||
bool _selectEnabled = false;
|
||||
HistoryItem *_selectedTextItem = nullptr;
|
||||
|
|
Loading…
Add table
Reference in a new issue