1. 14 Apr, 2020 - 1 commit
  2. 11 Mar, 2020 - 2 commits
  3. 05 Mar, 2020 - 1 commit
    • Shawn Rutledge's avatar
      Add PdfStyle; use Control palette colors · 60663c79
      Shawn Rutledge authored
      
      PdfStyle.qml can be overridden via file selectors, and contains extra
      styling beyond what Control.palette provides.
      
      Search results are highlighted with a lightened, translucent version of
      the Controls style's accent color, and the current search result is
      highlighted with a solid border with the accent color.
      
      The text selection color comes from the Controls theme highlight color,
      which tends to be the same as QPalette::Highlight.
      
      The link underscore is also configurable in PdfStyle, but its color
      comes from the Controls theme link color, which tends to be the same as
      QPalette::link.
      
      Task-number: QTBUG-82540
      Change-Id: I7c7e80323cf5d7c94dde775a38cdec239a6351a9
      Reviewed-by: default avatarMitch Curtis <mitch.curtis@qt.io>
      60663c79
  4. 04 Mar, 2020 - 2 commits
  5. 26 Feb, 2020 - 5 commits
    • Shawn Rutledge's avatar
      PdfMultiPageView: update search highlights when results change · 7e75e9b8
      Shawn Rutledge authored
      
      In the single-page view, we bind to the PdfSearchModel.currentPageBoundingPolygons
      property, which is convenient because it has a changed signal, so it
      stays updated in all cases: when the user changes the search string,
      when a different document is loaded, or when changing the current page.
      
      In the multi-page view, we need to invoke a function to get the search
      results on each page, because results are different on each page, and we
      often need to show multiple pages at the same time.  The challenge then
      is how to ensure that it gets re-evaluated often enough.  It requires
      connecting to more than one signal; but there isn't any way to "kick" a
      binding when some signal occurs, so the solution isn't very declarative,
      unfortunately.
      
      Change-Id: I72e7dad01b8cb6c43abcccf4fa46e443409b39e0
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      7e75e9b8
    • Shawn Rutledge's avatar
      PDF single-page example: shift content right as the search drawer opens · 82674435
      Shawn Rutledge authored
      This was done in 0b6a4d94
      
       for the
      multipage example.
      
      Change-Id: Ia5b51b9239521ab4d65e41aaebe52d178e75932d
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      82674435
    • Shawn Rutledge's avatar
      PdfSearchModel: provide ContextBefore and ContextAfter · 926afcaa
      Shawn Rutledge authored
      
      ...as separate roles, to make alignment easier, and to avoid hard-coding
      HTML tags in the Context role as it was before.
      
      But the strings in these context roles are not always adjacent to the
      search results in geometric coordinates sometimes, in some PDF files,
      despite having adjacent character indices.  I.e. the "next" character
      after the search string, or the "previous" character before it, could be
      anywhere on the page.
      
      Change-Id: Ief0a490b64fdb3c3ca98506926650648b609ece1
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      926afcaa
    • Shawn Rutledge's avatar
      PdfMultiPageView: highlight current search result when tapped in list · 8091944a
      Shawn Rutledge authored
      
      Change-Id: Ib0a1aeac28350c8705899ab799ce776e6764b306
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      8091944a
    • Shawn Rutledge's avatar
      PdfMultiPageView: retain position after pinch zoom · dbf1be9c
      Shawn Rutledge authored
      If you do the pinch on a trackpad, the mouse cursor doesn't move, and
      the same visible part of the page will remain under the cursor after the
      page is re-rendered.  Likewise when doing the pinch on a touchscreen,
      the centroid (midpoint between the two fingers) is held in place,
      subject to the constraints that Flickable.returnToBounds() imposes.
      Similar to 29cb44ee
      
      .
      
      Also corrected the horizontal scrolling range according to rotation;
      added left and right margins so that the page edges are more visible
      when the page is wider than the view, and thus the horizontal scrolling
      range feels more accurate while the scrollbars are still shown.
      
      Change-Id: Ia2a15eee5bcd5c9e7f025634f02a5a546e6aab68
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      dbf1be9c
  6. 21 Feb, 2020 - 2 commits
  7. 20 Feb, 2020 - 4 commits
    • Shawn Rutledge's avatar
      PdfScrollablePageView: improve positional navigation · c0aa9d79
      Shawn Rutledge authored
      Similar to f467edc9
      
      :
      NavigationStack is kept up-to-date when the scroll position changes, and
      can go back to a previous position; and links can in theory jump to
      specific positions and zoom levels, scrolling such that a specific x
      coordinate is visible.
      
      Change-Id: I2add617914d89b0dc5389e7c3d12d11580a1f82f
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      c0aa9d79
    • Shawn Rutledge's avatar
      PDF single-page example: move search field to the footer · 23e2fd1e
      Shawn Rutledge authored
      As with a2be3a7a
      
      , this makes the search
      feature more discoverable and touch-friendly.
      
      Change-Id: I47e37273c583121d60985cc27c22f56e6d655ab0
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      23e2fd1e
    • Shawn Rutledge's avatar
      Add PdfScrollablePageView, use it in the pdfviewer example · ff13e653
      Shawn Rutledge authored
      
      PdfPageView might be useful in some cases, but we need to get feature
      parity with PdfMultiPageView as much as possible, including scrollbars.
      Including them in the view is convenient, but also less flexible.
      
      Change-Id: Ibbe6a090a5f5b1d340124986fe49672d682ddedb
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      ff13e653
    • 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
  8. 19 Feb, 2020 - 4 commits
    • Shawn Rutledge's avatar
      QtPdf examples: use test.pdf from resources if no file given · 1acd9ad2
      Shawn Rutledge authored
      
      On iOS, the native FileDialog doesn't work, sharing doesn't work, and
      packaging files along with the application requires manual effort; so
      a PDF file in resources seems to be the easiest alternative to make
      the examples demo-able.
      
      QPdfDocument wants a file path, because it uses QFile; but we like
      to use URLs in Qt Quick.  So it's a bit of an impedance mismatch,
      there are several choices about when and where to do the conversion,
      and it's hard to say which way is more correct.  This way happens
      to work for now.
      
      Also do the rest of the things necessary to get this working on iOS.
      
      Change-Id: Icb8614d5eed2510f101aefba534ef80cf890518f
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      1acd9ad2
    • Shawn Rutledge's avatar
      PDF multipage example: move search field to the footer · a2be3a7a
      Shawn Rutledge authored
      
      Hiding the search feature in a closed Drawer might not have been
      sufficiently touch-friendly and discoverable, for example on iOS where
      the user is not going to press control-F to start searching.
      But the top toolbar is too full to put the search field back up there.
      It's familiar from Firefox to have the search field at the bottom,
      and we have enough space for it there.  So now you can search and
      jump around the search results without opening the drawer; but pressing
      Enter in the search field opens the drawer.  Hopefully swiping to open
      the drawer is also convenient enough on touch platforms; otherwise we
      could add another button for that, perhaps at the left of the footer.
      
      Change-Id: Iaec63bc22b03e29156fee817d197daae5b0cf9d5
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      a2be3a7a
    • Shawn Rutledge's avatar
      Fix PdfLinkModel's location y coordinate; add PdfMultiPageView tooltip · 57af89d1
      Shawn Rutledge authored
      
      As usual, coordinates are in the first quadrant, and we need to
      convert to 4th quadrant to get a y value that can be used to adjust
      contentY of a ListView or TableView.
      
      The tooltip when hovering over links provides a way to verify that
      the link really jumps where it's intended to.
      
      Change-Id: I9107639f15496a987c0fa7c3c2e2583c3839cc6b
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      57af89d1
    • Shawn Rutledge's avatar
      Guard against crash in QQuickPdfSearchModel::setDocument() · 34f52195
      Shawn Rutledge authored
      
      If the document is null, ignore it.
      
      Change-Id: I3cebd049fb5d16d0064dddf00183f231019ef03c
      Reviewed-by: default avatarShawn Rutledge <shawn.rutledge@qt.io>
      34f52195
  9. 17 Feb, 2020 - 5 commits
  10. 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
  11. 04 Feb, 2020 - 3 commits
  12. 03 Feb, 2020 - 7 commits