Thanks for your help, Wysota. I have been working some more with this, and it seems the only way I can get hold of this QGridLayout in my case is with some dirty code:

Qt Code:
  1. QList<QGridLayout*> grids = findChildren<QGridLayout*>();
  2. render_layout = grids[1]; // 0 = central widget layout, 1 = outer most layout which i need
To copy to clipboard, switch view to plain text mode 

Some observations:

  • It was not possible to retrieve the layout by any means of calling parent() or layout() on actual or parental widgets, Though there may be some workaround I have not found.
  • Calling findChild<QGridLayout*> with the standard name constructions for layouts in some cases yielded non-zero pointers, but they were all wild and caused program crashes. This appears to be a bug, but there might be some explanation to it.
  • GUiLoader does not provide the same functionality as the UIC tool as one would expect; the UIC will give layouts a standard name construction, the GUiLoader will not.
  • The Qt Designer does not expose QObject::objectName for layouts. It will set a name when dropping a layout widget, but not when dropping it on a group of selected widgets. Regardless, it will ignore objectName property when saving the form.

Conclusion:

  • Solution: Qt Designer must expose objectName for layouts so users can programatically obtain and use the layout in a safe way. The Designer must also be changed so it outputs this property when saving forms.


I will fiddle with this a bit more and probably send a bug-report/feature request.