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. Qt Quick:Removing empty spaces when the delegate is not visible in a gridview
Forum Updated to NodeBB v4.3 + New Features

Qt Quick:Removing empty spaces when the delegate is not visible in a gridview

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 878 Views 1 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.
  • A Offline
    A Offline
    ap02423
    wrote on 6 Oct 2013, 10:58 last edited by
    #1

    ml question:I am trying to use the following model and delegate components in a grid view. The model has a boolean role vis which turns the visible property of the delegate on or off. Later on I intend to bind this vis property to my backend.In this example the green button does not show up as intended but leaves an empty space between red and brown buttons. How do I get rid of the empty space. I just want the brown button to be next to red button

    This is my model component
    ListModel {

    ListElement {
        rectcolor:"red"
        vis:true
    }
    ListElement {
        rectcolor:"green"
        vis:false
    }
    ListElement
    {rectcolor:"brown"
     vis:true
    }
    

    }
    This is my delegate
    Rectangle {
    width: 100
    height: 62
    visible:model.vis
    Button{color:model.rectcolor}
    }

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Babalas
      wrote on 7 Oct 2013, 03:57 last edited by
      #2

      Try setting the height: model.vis ? 62 : 0.

      1 Reply Last reply
      0

      1/2

      6 Oct 2013, 10:58

      • Login

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