[SOLVED] addWidget determinded
If I add a QWidget in QHBoxLayout. Then it is always added at the end of all other already added QWidgets. Is there a possibility to add a QWidget to a determinded positon, e.g. at the second position?
I’m aware of the possibility to first remove all other QWidgets until the desired position and then add them again after. But this not very flexible if I don’t know how much widgets I have after the second position.
Thx for help.
Google is not great for Qt documentation. But the documentation itself is pretty good in general. This is really easy to find. You go to QVBoxLayout, find it pretty much empty of methods, and open op the docs for the super class QBoxLayout instead. A quick glance on that documentation reveals that you have add* methods as well as insert* methods. A pattern that is also available in may other classes dealing with lists or other ordered collections…