I have a 26 by 26 window, I need to fill it with rectangles, and some rectangles are bigger than others, and through this there is space between the rectangles, but I don’t need it to be. Red rectangles are those that are larger than the others. Black highlighted the space that is not filled.

First question: Tell me how to remove it?

The second question: I fill in everything manually, and fill it up to the ends. Can I somehow not hand fill? Thought fore, but int does not see ((source:

import QtQuick 2.5 import QtQuick.Controls 1.4 ApplicationWindow { visible: true width: 2200 height: 2200 title: qsTr("Game") Rectangle {color: "black"} Grid { x: 383 y: 0 width: 1321 height: 1027 columns: 26 spacing: 0 Rectangle { color: "blue"; width: 64; height: 64  } Rectangle { color: "white"; width: 32; height: 32 } Rectangle { color: "green"; width: 32; height: 32 .................... Rectangle { color: "blue"; width: 64; height: 64  } Rectangle { color: "green"; width: 32; height: 32 } Rectangle { color: "yellow"; width: 32; height: 32 } Rectangle { color: "white"; width: 32; height: 32 } Rectangle { color: "green"; width: 32; height: 32 } ..................... Rectangle { color: "white"; width: 32; height: 32 } Rectangle { color: "yellow"; width: 32; height: 32 } Rectangle { color: "green"; width: 32; height: 32 } } } 

my programa

  • Since you want, it will not work with the Grid . How do you imagine that in the grid a separate line ran into another? You need to use a different layout (or rather their combination, most likely. - ixSci
  • @ixSci, GridLayout tried. there are many hemorrhoids. And the dimensions do not understand what comes out - Oleg
  • You have GridLayout in your code. Offhand, I can say that in order to do what you want, you have to write your layout, which is generally not difficult, but you have to spend time. - ixSci

0