Dynamic Gridview Cellwidth and CellHeight

  • I'm using a GridView to display some rectangles. In the event that the number of icons I have is odd, I want to stretch the rectangles in the bottom row to fill that bottom row. I've been able to set the rectangles correctly, but the GridView cellWidth is proving difficult to change. Is there a way to set the GridView cellWidth differently based on the row that you're on? Something like:

            model: menuList
            delegate: menuItemDelegate
            cellHeight: parent.height / rows
            cellWidth: {
                //bottomColsFill is TRUE when there is an odd number of items in the menuList
                if(bottomColsFill && index > (menuList.length - cols)){
                    return parent.width / (cols - 1);
                    parent.width / cols;
            }// previous code parent.width / cols

Log in to reply