My QTabWidget
has 2 tabs on launch.
- Tab 1 is the one that's opened upon launch.
- Tab 2 contains some widgets of which I take the
QSize
to later draw similar elements in newly opened tabs.
The problem is that currently the size of the elements is 640x480 (apparently the default value), if tab 2 was not shown yet. Once tab 2 is selected, the elements are "drawn" and get their sizes depending on resolutio, window size etc.
How can I force the drawing of the elements in the background without opening tab 2, so that I can obtain the sizes the elements would have if the tab was opened? repaint
and update
do not do that.
My current workaround is to launch with tab 2 open and switch to tab 1 in main.cpp
between myWindow.show()
and myApp.exec()
but that seems a bit dirty.
sizeHint()
rather thansize()
– Jeremy Friesner