Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Why there is no "spacing" property for gridview ?

Why there is no "spacing" property for gridview ?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 695 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.
  • D Offline
    D Offline
    divaindie
    wrote on last edited by
    #1

    for listview there is "spacing" property by which we can spacify distance between two delegates.
    for example below code

    ListView{
            spacing: 100
            model:10
            anchors.fill: parent
            delegate: Rectangle{
                height : 50;width: 50
                color: "green"
            }
        }
    

    but for gridview there is "spacing" property as such. how can spacify the space between the delegates then?

    GridView{
            anchors.fill: parent
            height: 100
            width: 500
            model:10
            //spacing property not there
            delegate: Rectangle{
                height : 50;width: 50
                color: "green"
            }
        }
    
    JonBJ 1 Reply Last reply
    0
    • D divaindie

      for listview there is "spacing" property by which we can spacify distance between two delegates.
      for example below code

      ListView{
              spacing: 100
              model:10
              anchors.fill: parent
              delegate: Rectangle{
                  height : 50;width: 50
                  color: "green"
              }
          }
      

      but for gridview there is "spacing" property as such. how can spacify the space between the delegates then?

      GridView{
              anchors.fill: parent
              height: 100
              width: 500
              model:10
              //spacing property not there
              delegate: Rectangle{
                  height : 50;width: 50
                  color: "green"
              }
          }
      
      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @divaindie
      Google: qml gridview spacing

      On this forum, although old doubtless still works: https://forum.qt.io/topic/19775/solved-qml-gridview-and-spacing-between-children
      Or: https://stackoverflow.com/questions/37313843/how-to-create-spacing-in-gridview
      cellWidth/Height: https://doc.qt.io/qt-5/qml-qtquick-gridview.html#cellWidth-prop, https://doc.qt.io/qt-5/qml-qtquick-gridview.html#cellHeight-prop

      1 Reply Last reply
      1

      • Login

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