PDA

View Full Version : let QWidget send simultaneous resizeevent when resize happens



cic1988
18th November 2014, 07:58
Hello all,

in my project im using another layout system other than QLayout.
there is a layout algorithm which triggers a size calculation when QWidget::resize() happens.

i read the doc of QWidget::resize() only when the widget is visible he sends a resizeevent immediately.
is there any way to let a widget always send a resizeevent when resize happens?

ps: currently im using the trick with flag WA_WState_Visible, since this flag is even not documented i assume it is not supposed to use.

Thank you.

wysota
18th November 2014, 09:58
Why do you want to calculate the layout when the widget is hidden? Maybe you could recalculate the layout when showEvent() happens to avoid the problem. Better yet implement your own layout as a proper QLayout subclass.

cic1988
18th November 2014, 11:33
Why do you want to calculate the layout when the widget is hidden? Maybe you could recalculate the layout when showEvent() happens to avoid the problem. Better yet implement your own layout as a proper QLayout subclass.

Hello. We are not creating a new project while porting it to Qt.
because of historical reason the old layout we cannot remove in the near future.

may i know whether it is not recommanded to trigger a resizeevent before the widget visible?

wysota
18th November 2014, 12:02
Hello. We are not creating a new project while porting it to Qt.
because of historical reason the old layout we cannot remove in the near future.
I have no idea what you mean by that.


may i know whether it is not recommanded to trigger a resizeevent before the widget visible?
All widgets gain their physical attributes (like font size, size, etc.) when they are shown for the first time.

cic1988
18th November 2014, 12:18
I have no idea what you mean by that.

you suggest me to use QLayout. I wrote why i didnt use it.



All widgets gain their physical attributes (like font size, size, etc.) when they are shown for the first time.

then it's clear. Thanks.

wysota
18th November 2014, 12:23
you suggest me to use QLayout. I wrote why i didnt use it.

Almost all you need to do to make your layout QLayout compatible is to reimplement QLayout::setGeometry() and position all widgets from within that method.