[Interest] Update widget geometry BEFORE window shown
David M. Cotter
dave at kjams.com
Wed May 29 22:06:59 CEST 2024
Tried something like that:
qWidgetP->setAttribute(Qt::WA_DontShowOnScreen, true);
qWidgetP->show();
qWidgetP->hide();
qWidgetP->setAttribute(Qt::WA_DontShowOnScreen, false);
It doesn’t do as advertised (window does not show, but also doesn’t lay out the geometry of widgets)
-dave
> On May 29, 2024, at 11:29 AM, John Weeks <john at wavemetrics.com> wrote:
>
> Well, I wasn't going to say anything ("If you don’ know how to answer it, please don’t chime in, thanks.")
>
> In my experience, Qt doesn't maintain a good notion of a window's size until it's shown. But you are guaranteed a Resize event as the window is being shown, so if you can manage it, you need to handle the Resize event and do your polishing and layouting there.
>
> In fact, I had for a while a function called ShowAndHideInvisibly(); the important part of it was like this:
>> getQWidget()->setAttribute(Qt::WA_DontShowOnScreen, true);
>> WMshow();
>> WMhide();
>> getQWidget()->setAttribute(Qt::WA_DontShowOnScreen, false);
>
> Maybe that helps. Setting the attribute prevents the screen flash.
>
> -John Weeks
> WaveMetrics, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240529/fee8d047/attachment.htm>
More information about the Interest
mailing list