Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Brainstorm
  4. how to display items from model in varying sizes?

how to display items from model in varying sizes?

Scheduled Pinned Locked Moved Solved Brainstorm
4 Posts 3 Posters 469 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by mzimmers
    #1

    Hi all -

    I need to display the items of a model on a page that will show the items 4 across, except for certain items which need to be 2x wide as the others.

    I tried using a GridView for this:

    GridView {
        id: gridView
    
        property int nbrColumns: 4
        cellWidth: Layout.preferredWidth / nbrColumns
        cellHeight: 72 
        model: 6
    
        delegate: Pane {
            id: cellPane
            height: GridView.view.cellHeight
            width: (index === 2) ? (GridView.view.cellWidth * 2) : GridView.view.cellWidth
    

    but that produces this:
    Screenshot 2024-06-11 162545.png
    which is close to what I want, but the item with index 3 should not overlay item 2, but instead be on the next row.

    I would try using a GridLayout, but I don't know how I would "feed" model data to a Layout.

    Anyone have any other ideas?

    Thanks...

    jeremy_kJ 1 Reply Last reply
    0
    • mzimmersM mzimmers

      Hi all -

      I need to display the items of a model on a page that will show the items 4 across, except for certain items which need to be 2x wide as the others.

      I tried using a GridView for this:

      GridView {
          id: gridView
      
          property int nbrColumns: 4
          cellWidth: Layout.preferredWidth / nbrColumns
          cellHeight: 72 
          model: 6
      
          delegate: Pane {
              id: cellPane
              height: GridView.view.cellHeight
              width: (index === 2) ? (GridView.view.cellWidth * 2) : GridView.view.cellWidth
      

      but that produces this:
      Screenshot 2024-06-11 162545.png
      which is close to what I want, but the item with index 3 should not overlay item 2, but instead be on the next row.

      I would try using a GridLayout, but I don't know how I would "feed" model data to a Layout.

      Anyone have any other ideas?

      Thanks...

      jeremy_kJ Online
      jeremy_kJ Online
      jeremy_k
      wrote on last edited by
      #2

      @mzimmers said in how to display items from model in varying sizes?:

      I would try using a GridLayout, but I don't know how I would "feed" model data to a Layout.

      Repeater

      Asking a question about code? http://eel.is/iso-c++/testcase/

      J 1 Reply Last reply
      1
      • mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on last edited by
        #3

        Perfect. Thanks.

        1 Reply Last reply
        0
        • mzimmersM mzimmers has marked this topic as solved on
        • jeremy_kJ jeremy_k

          @mzimmers said in how to display items from model in varying sizes?:

          I would try using a GridLayout, but I don't know how I would "feed" model data to a Layout.

          Repeater

          J Offline
          J Offline
          jakasspeech5
          wrote on last edited by
          #4

          @jeremy_k said in how to display items from model in varying sizes?:

          @mzimmers said in how to display items from model in varying sizes?:

          I would try using a GridLayout, but I don't know how I would "feed" model data to a Layout.

          Repeater

          Thanks

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved