I’ve been lining up a possible new project today, thanks to stalling a bit on the work I was doing on Deep Sky Stacker. It’s more C++/Qt development, but in this case I thought I’d try to create the entire UI using QT Designer.
After several false starts I discovered that if I have, say, a main application window and want to put a QTabWidget inside it, the new widget doesn’t shrink or grow as the main window size changes (when the user resizes it, for instance).
It took quite some time to reach the understanding that some widgets, in particular the central widget of a QMainWindow and the main part of a QTabWidget require a layout widget to be associated with them before their contents will expand and contract with the outer window. But much of the time, Qt Designer doesn’t allow such a widget to be added.
I have discovered that what can be done to work around this is to start with (for example) the tab widget, add some random widget such as a pushbutton to it. After this is done it appears to be possible to set a layout for the container widget, add more widgets that I actually want, and throw the pushbutton away afterwards.
I had to take a similar approach when I wanted to add a layout to the layout of a tab widget.
I assume this must be some sort of bug in Qt Designer as it’s perfectly acceptable to create such things using code, even if it doesn’t allow them. I did wonder about editing the .ui file by hand, but hundreds of lines of XML? I’m not really up for it. I suspect that I might have found one or two other issues with the Designer too, but I haven’t put the time in to confirm those yet.
Meanwhile I shall get back to my design, now I have a clue how to beat Designer into submission.