1. 20 Feb, 2020 - 1 commit
    • Shawn Rutledge's avatar
      PdfMultiPageView: use TableView; horz. scroll; control page position · f467edc9
      Shawn Rutledge authored
      
      TableView is missing some features compared to ListView; so finding out
      where we currently are (which row) and programmatic positioning on a
      specific y coordinate of a specific row require some workarounds for now,
      including helpers in PdfDocument.
      
      TableView also assumes (and sporadically enforces) that all cells in a
      column have the same width.  So we need a placeholder Item for each page.
      This also helps with rotation: the placeholder is now as wide as the
      window or the image, whichever is wider, and the "paper" is centered
      within; thus there's always room to rotate it.
      
      There's still some problem with setting contentY in goToPage() after
      the page has been zoomed to a size larger than the window: the values
      look correct, but it scrolls too far.
      
      But on the plus side, horizontal scrolling works.  So now we attempt to
      control the horizontal position too: NavigationStack tracks it, and can
      go back to a previous position; and links can in theory jump to specific
      positions and zoom levels, scrolling horizontally such that a specific x
      coordinate is visible.
      
      Includes minor UI tweaks to make it look better on iOS.
      
      Change-Id: I643d8ef48ef815aeb49cae77dcb84c3682563d56
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      f467edc9
  2. 19 Feb, 2020 - 1 commit
  3. 17 Feb, 2020 - 1 commit
    • Shawn Rutledge's avatar
      PdfSearchModel: be QALM and find search results on all pages · 0b6a4d94
      Shawn Rutledge authored
      
      It's a QAbstractListModel, so now PdfMultiPageView has a ListView in a
      left-side Drawer showing all results found so far.
      
      - In PdfMultiPageView, multiple pages exist at once, so it makes sense
        to use the same searchmodel for all.
      - It's faster and saves memory.
      - Search results on each page can be cached.
      - It's possible to show search results in a ListView or QListView.
      
      Change-Id: I66fba6975954a09a4d23262be87ff8cc25ee7478
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      0b6a4d94
  4. 11 Feb, 2020 - 4 commits
    • Shawn Rutledge's avatar
      PDF multipage viewer: iterate search results · e5a33355
      Shawn Rutledge authored
      
      This version still has separate PdfSearchModel instances on each page,
      but now there are buttons to iterate and highlight the search results
      in order.  When you come to the last result on one page, hitting the
      "Find Next" button will jump to the next page, and keep jumping forward
      from there until another result is found.  Unfortunately this jumping
      takes time if it skips over a lot of pages because of empty search
      results.  That seems to be another reason to make PdfSearchModel into a
      whole-document search model and use one instance.
      
      Also reorganize PdfMultiPageView.qml's public API into sections
      according to functionality rather than by type.
      
      Change-Id: I677a764fcbf231b2656aff8abe7240a27582a696
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      e5a33355
    • Shawn Rutledge's avatar
      PDF multipage view: track specific link and navigation destinations · 7afe95f1
      Shawn Rutledge authored
      
      Unfortunately it's getting harder to do things declaratively, because we
      have to avoid circular bindings, and because of needing to use imperative
      APIs.  The current-page spinbox provides onValueModified() to detect when
      the user modifies it, distinct from the simple fact that the value changed.
      We shouldn't make bindings to set ListView.currentIndex anyway, because
      that results in slow animation (and loading pages in all delegates along
      the way) rather than quick jumping to the correct page.  Instead we need
      to use ListView.positionViewAtIndex(), another imperative API, to get
      quick jumps without having to calculate and set contentY in some other way.
      
      Now we move toward the NavigationStack providing storage for the current
      destination at all times.  Changes there will trigger programmatically
      moving the ListView.
      
      When the user scrolls manually, that generates a "destination" in the
      navigation stack, such that the back button can jump back to the
      previous location, and then the forward button can return to the
      destination where manual scrolling ended up.
      
      Fixes: QTBUG-77510
      Change-Id: I47544210d2e0f9aa790f3d2594839678374e463d
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      7afe95f1
    • Shawn Rutledge's avatar
      PDF multipage view: add vertical scrollbar · 92cd38cd
      Shawn Rutledge authored
      
      So far it does not update the spinbox with the current page to which
      the user has scrolled, because ListView.currentIndex doesn't change.
      
      Change-Id: I5dfa644401f77628c71ad1db7d64c5f0ac1e0c65
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      92cd38cd
    • Shawn Rutledge's avatar
      Add QPdfDestination; NavigationStack stores page, location and zoom · 09a6eac4
      Shawn Rutledge authored
      
      Push/back/forward behavior seems more correct now, but still no
      autotest yet.
      
      QPdfDestination might be useful to represent locations of search results,
      for link destinations and maybe named destinations too.
      
      Fixes: QTBUG-77512
      Change-Id: I113b2c535a2cd302106e6546104c64e12985d387
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      09a6eac4
  5. 04 Feb, 2020 - 2 commits
    • Shawn Rutledge's avatar
      Add zoom and rotation to PdfMultiPageView · 25a371ca
      Shawn Rutledge authored
      
      Currently, scaleToWidth() and scaleToPage() choose the scale of the
      first page to fit the given viewport size, and as long as all pages are
      the same size, it works.  On the other hand, the PinchHandler only
      affects the scale of the page on which the pinch gesture occurs.
      Calling resetScale(), scaleToWidth() or scaleToPage() undoes the
      effect of any previous pinch gesture or any other kind of scaling change.
      
      Task-number: QTBUG-77513
      Change-Id: Ia3227ca9c4af263eb8505dbd6336657984c66ab0
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      25a371ca
    • Shawn Rutledge's avatar
      Temporarily use MouseArea for links in Pdf(Multi)PageView · 1f785521
      Shawn Rutledge authored
      
      HoverHandler.cursorShape is new API in 5.15, so we have to use
      MouseArea for 5.14.
      
      This patch can be reverted as soon as 5.14 is no longer supported.
      
      Change-Id: I1c830215729038095ec33ece36a1a83108cbd835
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      1f785521
  6. 03 Feb, 2020 - 1 commit