Commit 843c43cc 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 dc74ffa6
Pipeline #38207 passed with stage
in 27 minutes and 24 seconds
......@@ -316,10 +316,6 @@ void PartTest::testClickInternalLink()
QTRY_COMPARE(part.m_document->currentPage(), 1u);
// make sure cursor goes back to being an open hand again. Bug 421437
// TODO: This test for bug 421437 has been committed when there was no fix for the bug
// available yet. That's why the QTRY_COMPARE_WITH_TIMEOUT is preceded by QEXPECT_FAIL.
// Please remove the QEXPECT_FAIL together with the fix for bug 421437.
QEXPECT_FAIL("", "Please remove this QEXPECT_FAIL once bug 421437 is fixed!", Continue);
QTRY_COMPARE_WITH_TIMEOUT(part.m_pageView->cursor().shape(), Qt::OpenHandCursor, 1000);
......@@ -3171,8 +3171,6 @@ void PageView::wheelEvent(QWheelEvent *e)
bool PageView::viewportEvent(QEvent *e)
......@@ -3225,6 +3223,8 @@ void PageView::scrollContentsBy(int dx, int dy)
for (const QRect &rect : rgn)
// END widget events
......@@ -3895,12 +3895,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());
Markdown is supported
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