Commit 8b008b02 authored by David Hurka's avatar David Hurka 🐬 Committed by Nate Graham
Browse files

Fix cursor not updated after clicking internal link

updateCursor() was called by wheelEvent(), which made sense,
because after the wheel event the page will have moved under the cursor.

With smooth scrolling, it makes less sense in wheelEvent(),
because at that point scrolling is still in the future.

scrollContentsBy() appears to be called on every scroll step.
(It is documented to be called at scrollbar value changes, so makes sense.)

This patch removes updateCursor() from wheelEvent(), but adds it to scrollContentsBy().

I did not check anything out with d->visibleItems, as was indicated it !176.

BUG: 421437
parent 17c26699
......@@ -3139,8 +3139,6 @@ void PageView::wheelEvent(QWheelEvent *e)
bool PageView::viewportEvent(QEvent *e)
......@@ -3193,6 +3191,8 @@ void PageView::scrollContentsBy(int dx, int dy)
for (const QRect &rect : rgn)
// END widget events
......@@ -3863,12 +3863,15 @@ void PageView::updateCursor(const QPoint p)
// detect the underlaying page (if present)
PageViewItem *pageItem = pickItemOnPoint(p.x(), p.y());
QScroller::State scrollerState = d->scroller->state();
if (d->annotator && d->annotator->active()) {
if (pageItem || d->annotator->annotating())
} else if (scrollerState == QScroller::Pressed || scrollerState == QScroller::Dragging) {
} else if (pageItem) {
double nX = pageItem->absToPageX(p.x());
double nY = pageItem->absToPageY(p.y());
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment