Sorry if I wasn’t clear, I meant simply “don’t tell me to no longer have the 
requirement to get the correct/updated rectangles before the window is shown”

Please do FEEL FREE to tell me how to do anything differently, as long as we 
keep the requirement "get the correct/updated rectangles before the window is 
shown”

:)

> On May 26, 2024, at 11:58 PM, Axel Spoerl via Interest 
> <interest@qt-project.org> wrote:
> 
> Hi David,
> 
> §1 Please don’t try to tell me to do it differently.
> §2 If you don’ know how to answer it, please don’t chime in, thanks.
> 
> These instructions are a bit limiting, are they not?
> 
> In essence, you want a widget's geometry to be precise and up to date, before 
> it has been shown.
> That is done (under more), if QWidgetPrivate::updateGeometry_helper(true) is 
> called.
> There are three ways to achieve that on a hidden widget:
> setVisible(true), show() => probably not an option
> setMaximumSize()
> setMinimumSize() => under certain circumstances.
> 
> Except for the first code path shown, all others cause the helper to be 
> called with a "false" argument, hence the result is not to your liking.
> I haven't debugged with negative co-ordinates. Maybe it works. However, I 
> would be reluctant to depend on something like that.
> There are hacky ways, like re-implementing geometry calculation in the 
> application, linking to WidgetsPrivate. I guess you have discarded those for 
> good reasons.
> 
> With §1 in sight: Grinding stop.
> 
> Cheers
> Axel
> Von: Interest <interest-boun...@qt-project.org> im Auftrag von coroberti 
> <corobe...@gmail.com>
> Gesendet: Montag, 27. Mai 2024 08:05
> An: David M. Cotter <d...@kjams.com>
> Cc: Qt Project <Interest@qt-project.org>
> Betreff: Re: [Interest] Update widget geometry BEFORE window shown
>  
> Have you tried the suggestion from Henry to move the window first to the 
> negative coordinates?
> 
> Kind regards,
> Robert Iakobashvili
> ............................
> 
> 
> On Mon, May 27, 2024 at 9:01 AM David M. Cotter <d...@kjams.com 
> <mailto:d...@kjams.com>> wrote:
> Does ANY ONE have any ideas on this?? Pretty please??
> 
> -dave
> 
>> On May 24, 2024, at 12:14 PM, David M. Cotter <d...@kjams.com 
>> <mailto:d...@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 <corobe...@gmail.com 
>>> <mailto:corobe...@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 <d...@kjams.com 
>>> <mailto:d...@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@qt-project.org <mailto:Interest@qt-project.org>
>>>> https://lists.qt-project.org/listinfo/interest
>> 
>> _______________________________________________
>> Interest mailing list
>> Interest@qt-project.org <mailto:Interest@qt-project.org>
>> https://lists.qt-project.org/listinfo/interest
> 
> _______________________________________________
> Interest mailing list
> Interest@qt-project.org <mailto:Interest@qt-project.org>
> https://lists.qt-project.org/listinfo/interest

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to