Fix bug: select browse tool after trim select

remotes/origin/work/spdx
Gerd Wachsmuth 5 years ago committed by Nate Graham
parent ef5254b020
commit 6a6b6ca345
  1. 16
      autotests/parttest.cpp
  2. 3
      part/pageview.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);

@ -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

Loading…
Cancel
Save