diff --git a/part/pageview.cpp b/part/pageview.cpp index 9153fd6b7..773f09ad3 100644 --- a/part/pageview.cpp +++ b/part/pageview.cpp @@ -429,6 +429,7 @@ PageView::PageView(QWidget *parent, Okular::Document *document) QScrollerProperties prop; prop.setScrollMetric(QScrollerProperties::DecelerationFactor, 0.3); prop.setScrollMetric(QScrollerProperties::MaximumVelocity, 1); + prop.setScrollMetric(QScrollerProperties::AcceleratingFlickMaximumTime, 0.2); // Workaround for QTBUG-88249 (non-flick gestures recognized as accelerating flick) prop.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff); prop.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, QScrollerProperties::OvershootAlwaysOff); prop.setScrollMetric(QScrollerProperties::DragStartDistance, 0.0); @@ -4021,6 +4022,21 @@ void PageView::center(int cx, int cy, bool smoothMove) void PageView::scrollTo(int x, int y, bool smoothMove) { +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + // Workaround for QTBUG-88288, (KDE bug 425188): To avoid a crash in QScroller, + // we need to make sure the target widget intersects a physical screen. + // QScroller queries QDesktopWidget::screenNumber(). + + // If we are not on a physical screen, we try to make our widget big enough. + // The geometry will be restored to a sensible value once the Part is shown. + + // It should be enough to add this workaround ony in PageView::scrollTo(), + // because we don’t expect other QScroller::scrollTo() calls before PageView is shown. + if (QApplication::desktop()->screenNumber(this) < 0) { + setGeometry(QRect(-1000, -1000, 5000, 5000).united(QApplication::desktop()->availableGeometry())); + } +#endif + bool prevState = d->blockPixmapsRequest; int newValue = -1;