mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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();
|
e->accept();
|
||||||
return; // ignore mouse press, that was hiding context menu
|
return; // ignore mouse press, that was hiding context menu
|
||||||
}
|
}
|
||||||
|
_mouseActive = true;
|
||||||
mouseActionStart(e->globalPos(), e->button());
|
mouseActionStart(e->globalPos(), e->button());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3161,6 +3162,7 @@ void ListWidget::mouseMoveEvent(QMouseEvent *e) {
|
||||||
mouseReleaseEvent(e);
|
mouseReleaseEvent(e);
|
||||||
}
|
}
|
||||||
if (reallyMoved) {
|
if (reallyMoved) {
|
||||||
|
_mouseActive = true;
|
||||||
lastGlobalPosition = e->globalPos();
|
lastGlobalPosition = e->globalPos();
|
||||||
if (!buttonsPressed
|
if (!buttonsPressed
|
||||||
|| (_scrollDateLink
|
|| (_scrollDateLink
|
||||||
|
@ -3191,6 +3193,7 @@ rpl::producer<bool> ListWidget::touchMaybeSelectingValue() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListWidget::enterEventHook(QEnterEvent *e) {
|
void ListWidget::enterEventHook(QEnterEvent *e) {
|
||||||
|
_mouseActive = true;
|
||||||
mouseActionUpdate(QCursor::pos());
|
mouseActionUpdate(QCursor::pos());
|
||||||
return TWidget::enterEventHook(e);
|
return TWidget::enterEventHook(e);
|
||||||
}
|
}
|
||||||
|
@ -3211,6 +3214,7 @@ void ListWidget::leaveEventHook(QEvent *e) {
|
||||||
_cursor = style::cur_default;
|
_cursor = style::cur_default;
|
||||||
setCursor(_cursor);
|
setCursor(_cursor);
|
||||||
}
|
}
|
||||||
|
_mouseActive = false;
|
||||||
return TWidget::leaveEventHook(e);
|
return TWidget::leaveEventHook(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3643,6 +3647,10 @@ int ListWidget::SelectionViewOffset(
|
||||||
|
|
||||||
|
|
||||||
void ListWidget::mouseActionUpdate() {
|
void ListWidget::mouseActionUpdate() {
|
||||||
|
if (!_mouseActive && !window()->isActiveWindow()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto mousePosition = mapFromGlobal(_mousePosition);
|
auto mousePosition = mapFromGlobal(_mousePosition);
|
||||||
auto point = QPoint(
|
auto point = QPoint(
|
||||||
std::clamp(mousePosition.x(), 0, width()),
|
std::clamp(mousePosition.x(), 0, width()),
|
||||||
|
|
|
@ -816,6 +816,7 @@ private:
|
||||||
uint16 _mouseTextSymbol = 0;
|
uint16 _mouseTextSymbol = 0;
|
||||||
bool _pressWasInactive = false;
|
bool _pressWasInactive = false;
|
||||||
bool _overSenderUserpic = false;
|
bool _overSenderUserpic = false;
|
||||||
|
bool _mouseActive = false;
|
||||||
|
|
||||||
bool _selectEnabled = false;
|
bool _selectEnabled = false;
|
||||||
HistoryItem *_selectedTextItem = nullptr;
|
HistoryItem *_selectedTextItem = nullptr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue