mirror of https://github.com/procxx/kepka.git
Show floating date only when scrolling up.
This commit is contained in:
parent
185bdb6704
commit
0eb2d28d90
|
@ -809,13 +809,18 @@ void HistoryInner::touchEvent(QTouchEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryInner::mouseMoveEvent(QMouseEvent *e) {
|
void HistoryInner::mouseMoveEvent(QMouseEvent *e) {
|
||||||
|
static auto lastGlobalPosition = e->globalPos();
|
||||||
|
auto reallyMoved = (lastGlobalPosition != e->globalPos());
|
||||||
auto buttonsPressed = (e->buttons() & (Qt::LeftButton | Qt::MiddleButton));
|
auto buttonsPressed = (e->buttons() & (Qt::LeftButton | Qt::MiddleButton));
|
||||||
if (!buttonsPressed && _dragAction != NoDrag) {
|
if (!buttonsPressed && _dragAction != NoDrag) {
|
||||||
mouseReleaseEvent(e);
|
mouseReleaseEvent(e);
|
||||||
}
|
}
|
||||||
if (!buttonsPressed || ClickHandler::getPressed() == _scrollDateLink) {
|
if (reallyMoved) {
|
||||||
|
lastGlobalPosition = e->globalPos();
|
||||||
|
if (!buttonsPressed || (_scrollDateLink && ClickHandler::getPressed() == _scrollDateLink)) {
|
||||||
keepScrollDateForNow();
|
keepScrollDateForNow();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
dragActionUpdate(e->globalPos());
|
dragActionUpdate(e->globalPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1727,6 +1732,7 @@ void HistoryInner::setFirstLoading(bool loading) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryInner::visibleAreaUpdated(int top, int bottom) {
|
void HistoryInner::visibleAreaUpdated(int top, int bottom) {
|
||||||
|
auto scrolledUp = (top < _visibleAreaTop);
|
||||||
_visibleAreaTop = top;
|
_visibleAreaTop = top;
|
||||||
_visibleAreaBottom = bottom;
|
_visibleAreaBottom = bottom;
|
||||||
|
|
||||||
|
@ -1757,7 +1763,11 @@ void HistoryInner::visibleAreaUpdated(int top, int bottom) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (scrolledUp) {
|
||||||
_scrollDateCheck.call();
|
_scrollDateCheck.call();
|
||||||
|
} else {
|
||||||
|
onScrollDateHideByTimer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HistoryInner::displayScrollDate() const {
|
bool HistoryInner::displayScrollDate() const {
|
||||||
|
@ -1791,7 +1801,7 @@ void HistoryInner::onScrollDateCheck() {
|
||||||
|
|
||||||
void HistoryInner::onScrollDateHideByTimer() {
|
void HistoryInner::onScrollDateHideByTimer() {
|
||||||
_scrollDateHideTimer.stop();
|
_scrollDateHideTimer.stop();
|
||||||
if (ClickHandler::getPressed() != _scrollDateLink) {
|
if (!_scrollDateLink || ClickHandler::getPressed() != _scrollDateLink) {
|
||||||
scrollDateHide();
|
scrollDateHide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue