diff --git a/autotests/parttest.cpp b/autotests/parttest.cpp index 7c0639b99..13c38ce7e 100644 --- a/autotests/parttest.cpp +++ b/autotests/parttest.cpp @@ -2130,11 +2130,20 @@ void PartTest::testLinkWithCrop() // wait for pixmap QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView)); + const int width = part.m_pageView->viewport()->width(); + const int height = part.m_pageView->viewport()->height(); + + // Move to a location without a link + QTest::mouseMove(part.m_pageView->viewport(), QPoint(width * 0.1, width * 0.1)); + + // The cursor should be normal + QCOMPARE(part.m_pageView->cursor().shape(), Qt::CursorShape(Qt::OpenHandCursor)); + // Activate "Trim Margins" cropAction->trigger(); - const int width = part.m_pageView->viewport()->width(); - const int height = part.m_pageView->viewport()->height(); + // The cursor should be a cross-hair + QCOMPARE(part.m_pageView->cursor().shape(), Qt::CursorShape(Qt::CrossCursor)); const int mouseStartY = height * 0.2; const int mouseEndY = height * 0.8; @@ -2144,6 +2153,9 @@ void PartTest::testLinkWithCrop() // Trim the page simulateMouseSelection(mouseStartX, mouseStartY, mouseEndX, mouseEndY, part.m_pageView->viewport()); + // The cursor should be normal again + QCOMPARE(part.m_pageView->cursor().shape(), Qt::CursorShape(Qt::OpenHandCursor)); + // Click a link const QPoint click(width * 0.2, height * 0.2); QTest::mouseMove(part.m_pageView->viewport(), click); diff --git a/part/pageview.cpp b/part/pageview.cpp index c6a0e5806..70e092c0f 100644 --- a/part/pageview.cpp +++ b/part/pageview.cpp @@ -4970,7 +4970,10 @@ void PageView::slotTrimToSelectionToggled(bool on) if (on) { // Turn off any other Trim modes updateTrimMode(d->aTrimToSelection->data().toInt()); + // Change the mouse mode d->mouseMode = Okular::Settings::EnumMouseMode::TrimSelect; + d->aMouseNormal->setChecked(false); + // change the text in messageWindow (and show it if hidden) d->messageWindow->display(i18n("Draw a rectangle around the page area you wish to keep visible"), QString(), PageViewMessage::Info, -1); // force an update of the cursor