[Interest] Update widget geometry BEFORE window shown

David M. Cotter dave at kjams.com
Mon May 27 08:01:13 CEST 2024


Does ANY ONE have any ideas on this?? Pretty please??

-dave

> On May 24, 2024, at 12:14 PM, David M. Cotter <dave at kjams.com> wrote:
> 
> I’ve tried everything I can think of. The ONLY one that works the way I NEED is the first one, but that one flashes the window on the screen
> 
> 			#if 1
> 				qWidgetP->show();
> 				qWidgetP->hide();
> 				QtLetTimersFire(0);
> 			#endif
> 
> 			#if 0
> 				QLayout*	layoutP(qWidgetP->layout());
> 
> 				layoutP->update();
> 				layoutP->activate();
> 				QtLetTimersFire(0);
> 			#endif
> 
> 			#if 0
> 				for (auto* childP: qWidgetP->findChildren<QWidget*>()) {
> 					childP->updateGeometry();
> 				}
> 
> 				qWidgetP->updateGeometry();
> 				QtLetTimersFire(0);
> 			#endif
> 
> 			#if 0
> 				qWidgetP->setAttribute(Qt::WA_DontShowOnScreen, true);
> 				qWidgetP->show();
> 				// qWidgetP->layout()->invalidate();
> 				// qWidgetP->layout()->update();
> 				// qWidgetP->layout()->activate();
> 				qWidgetP->hide();
> 				qWidgetP->setAttribute(Qt::WA_DontShowOnScreen, false);
> 				QtLetTimersFire(0);
> 			#endif
> 
> 			#if 0
> 				qWidgetP->setAttribute(Qt::WA_DontShowOnScreen, true);
> 				qWidgetP->show();
> 
> 				qWidgetP->layout()->invalidate();
> 				qWidgetP->layout()->update();
> 				qWidgetP->layout()->activate();
> 
> 				for (auto* childP: qWidgetP->findChildren<QWidget*>()) {
> 					childP->updateGeometry();
> 				}
> 
> 				qWidgetP->updateGeometry();
> 
> 				qWidgetP->hide();
> 				qWidgetP->setAttribute(Qt::WA_DontShowOnScreen, false);
> 				QtLetTimersFire(0);
> 			#endif
> 
> 
>> On May 24, 2024, at 12:47 AM, coroberti <coroberti at gmail.com> wrote:
>> 
>> 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
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240526/2afbce04/attachment.htm>


More information about the Interest mailing list