0

Is it possible to have QGridLayouts within another QGridLayout? I have been trying to do this using the UI designer, so that I can resize all QGridLayouts uniformly.

This is for an Ultimate-Tic-Tac-Toe game I am creating for fun.

Here, I have nine QGridlayouts. I want to group them together. If I want to expand the boxes, I have to go through each one and expand them. Or I have to copy/paste the first box and make sure they are all aligned again.

enter image description here

I tried selecting all of them and clicking Lay Out in a Grid , but that messes up how they are displayed. Especially the lines that separate the layouts. Am I not doing this correctly?

This just looks weird:

enter image description here

Quaxton Hale
  • 2,460
  • 5
  • 40
  • 71
  • Layouts like this typically are best suited to doing with code vs. in the designer. Perhaps the spirit of [my answer about this battleship game](http://stackoverflow.com/questions/8335025/qt-update-pixmap-grid-layout-with-2d-array-values) would be helpful. – HostileFork says dont trust SE Oct 28 '14 at 02:21

1 Answers1

1

Yes, there is no any problems inserting QGridLayout into another QGridLayout. Here is a demonstration how it can be done in the designer.
Pay attention that there are no any lines when you open the widget in the Preview: they are visible only for design purposes. Buttons are added to the layouts just to see how they are places in the Preview.

enter image description here

Ezee
  • 4,214
  • 1
  • 14
  • 29