Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-102739

PdfMultiPageView: zooming out after scrolling to end results in persistent overshoot

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.4.0 FF
    • None

    Description

      • Run the example qtwebengine/examples/pdf/multipage with a multi-page PDF
      • Zoom in (maybe several times)
      • Scroll to the end
      • Zoom out

      The result is you will see an empty viewport, because now TableView.contentHeight should be much less, but in fact it's currently looking at a region that is beyond the end of document. The vertical scrollbar goes missing in this condition. You just have to use the mouse wheel briefly to trigger it to return to bounds.

      We should somehow trigger QQuickFlickable::returnToBounds() at the right time, perhaps; but doing that immediately doesn't seem to help.

      Since https://codereview.qt-project.org/c/qt/qtwebengine/+/298999 we have this rebuild() workaround, which fixes some cases, just not this one:

      Item {
          /*!
              \qmlproperty real PdfMultiPageView::renderScale
      
              This property holds the ratio of pixels to points. The default is \c 1,
              meaning one point (1/72 of an inch) equals 1 logical pixel.
      
              \sa PdfPageImage::status
          */
          property real renderScale: 1
      
          TableView {
              model: modelInUse && root.document ? root.document.pageCount : 0
              // workaround to make TableView do scheduleRebuildTable(RebuildOption::All) in cases when forceLayout() doesn't
              property bool modelInUse: true
              function rebuild() {
                  modelInUse = false
                  modelInUse = true
                  returnToBounds(); // doesn't help
              }
              // end workaround
      ...
      
          onRenderScaleChanged: {
              // if navigationStack.jumped changes the scale, don't turn around and update the stack again;
              // and don't force layout either, because positionViewAtCell() will do that
              if (navigationStack.jumping)
                  return
              // make TableView rebuild from scratch, because otherwise it doesn't know the delegates are changing size
              tableView.rebuild()
          }
      

      Attachments

        Activity

          People

            srutledg Shawn Rutledge
            srutledg Shawn Rutledge
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: