[Interest] Update widget geometry BEFORE window shown

coroberti coroberti at gmail.com
Fri May 24 09:47:48 CEST 2024


David,
Try
yourWidget->layout()->update();
yourWidget->layout()->activate();

If not,
let the event loop to run, ie. arranging a short timer.

Kind regards,
Robert Iakobashvili
............................

On Fri, May 24, 2024 at 1:53 AM David M. Cotter <dave at kjams.com> wrote:
>
> I need to do something like this:
>
> windowP->layout()->updateGeometry(); // causes all widget geometry to update
> DoSomethingImportant(windowP->GetWidget(“someWidget”).geometry()); // do something with the geometry of a widget (which must be up to date)
> windowP->setGeometry(windowP->GetInitialGeometry()); // pos/size now based on the fact that we KNOW the geometry of one of the widgets BEFORE the window is shown
> windowP->show(); // only NOW show the window, NOT before now
>
> How do I do something like the first line? Cause all widget geometry (Recursively), to know / figure out its size AND position? And this BEFORE the window or any widget is “shown”  via the windowP->show() command?
>
> Please don’t try to tell me to do it differently. If you don’ know how to answer it, please don’t chime in, thanks.
>
> -Dave
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest


More information about the Interest mailing list