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

ListView should set implicitWidth to the max of its delegates' widths

    XMLWordPrintable

Details

    Description

      I'm writing the multi-page PDF viewer for QtPDF. It was natural to get started using ListView to arrange pages vertically and be able to flick through them; so each delegate is one page from the PDF. Next, I want to add horizontal scrolling. The natural thing is to put the whole ListView into a horizontal-scrolling Flickable. What should its contentWidth be? Different pages can be different sizes. So I need the horizontal Flickable's contentWidth to be the max of the widths of all delegates (pages) that are currently visible (or currently instantiated? or all delegates ever seen?) in the ListView. So it seems natural that implicitWidth of the ListView should provide some sort of maximum width like that: either the current maximum or the all-time maximum. (maybe configure the calculation method with another property?) Then I could just bind width: implicitWidth. I don't want to do any QML hack-arounds to iterate delegates myself and find this out.

      Since this isn't there, I will try to switch to TableView, because it already knows how to do horizontal scrolling. But it can't be the first time someone has wanted to do this with ListView.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qt.team.quick.subscriptions Qt Quick and Widgets Team
              srutledg Shawn Rutledge
              Votes:
              3 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes