[Qt-interest] QTabWidget resize events on hidden tabs
Tony Rietwyk
tony.rietwyk at rightsoft.com.au
Wed Oct 21 01:18:29 CEST 2009
Giacomo wrote:
> Hi.
> Can someone explain how QResizeEvents are delivered to hidden
> widgets of a
> QTabWidget.
>
> I need to place QWidgets on the tabs of a QTabWidget, and to
> proportionally
> resize them when the QTabWidget is resized.
>
> I do like this:
>
> QTabWidget *tabW = new QTabWidget;
> QWidget *tab1 = new QWidget(0);
> QWidget *tab2 = new QWidget(0);
> tabW->addTab(tab1);
> tabW->addTab(tab2);
> QLabel *l1 = new QLabel(tab1);
> QLabel *l2 = new QLabel(tab2);
>
> When I resize QTabWidget, I want to resize proportionally
> labels l2 and l1.
> But if tab1 is visible, then it seems that resize events on
> tab2 have an
> invalid oldSize().
>
> How can I do to cleanly resize widgets children of hidden tabs?
>
> Thanks in advance.
>
> Giacomo
Hi,
I have recently found that some size settings are not initialised as you
would expect until the show event - eg, frameGeometry doesn't work when
called in the constructor.
Try setting the label size in the showEvent of tab2, either before or after
calling the inherited routine.
Tony.
More information about the Qt-interest-old
mailing list