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?
Forum Updated to NodeBB v4.3 + New Features

how to display items from model in varying sizes?

Scheduled Pinned Locked Moved Solved Brainstorm
4 Posts 3 Posters 573 Views 4 Watching
  • 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.
  • M Offline
    M Offline
    mzimmers
    wrote on 11 Jun 2024, 23:38 last edited by mzimmers 6 Nov 2024, 23:39
    #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...

    J 1 Reply Last reply 12 Jun 2024, 04:02
    0
    • M mzimmers
      11 Jun 2024, 23:38

      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...

      J Offline
      J Offline
      jeremy_k
      wrote on 12 Jun 2024, 04:02 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 Aug 2024, 16:49
      1
      • M Offline
        M Offline
        mzimmers
        wrote on 13 Jun 2024, 02:18 last edited by
        #3

        Perfect. Thanks.

        1 Reply Last reply
        0
        • M mzimmers has marked this topic as solved on 13 Jun 2024, 02:18
        • J jeremy_k
          12 Jun 2024, 04:02

          @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 1 Aug 2024, 16:49 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

          4/4

          1 Aug 2024, 16:49

          • Login

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