Re: [Interest] Update widget geometry BEFORE window shown

2024-05-28 Thread David M. Cotter
Yes I did. Sorry I didn’t document that:
//  this doesn't work because the window 
position is constrained to the boundaries
//  of the display. it shows at (0, 0), 
causing an on-screen flash.
//  can the constraint be temporarily 
lifted so it actually shows at (-32000, -32000) ??


> On May 26, 2024, at 11:05 PM, coroberti  wrote:
> 
> 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  > wrote:
>> Does ANY ONE have any ideas on this?? Pretty please??
>> 
>> -dave
>> 
>>> On May 24, 2024, at 12:14 PM, David M. Cotter >> > 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

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


Re: [Interest] Update widget geometry BEFORE window shown

2024-05-28 Thread David M. Cotter
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 
>  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  im Auftrag von coroberti 
> 
> Gesendet: Montag, 27. Mai 2024 08:05
> An: David M. Cotter 
> Cc: Qt Project 
> 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  > wrote:
> Does ANY ONE have any ideas on this?? Pretty please??
> 
> -dave
> 
>> On May 24, 2024, at 12:14 PM, David M. Cotter > > 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()) {
>> 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()) {
>> childP->updateGeometry();
>> }
>> 
>> qWidgetP->updateGeometry();
>> 
>> qWidgetP->hide();
>> qWidgetP->setAttribute(Qt::WA_DontShowOnScreen, false);
>> QtLetTimersFire(0);
>> #endif
>> 
>> 
>>> On May 24, 2024, at 12:47 AM, coroberti >> > 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 >> > 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 
 https://lists.qt-project.org/listinfo/interest
>> 
>> ___

Re: [Interest] Update widget geometry BEFORE window shown

2024-05-28 Thread David M. Cotter
Tried that too, to no avail

static void activateLayoutsRecursive(QObject *objectP)
{
if (objectP) {

for (auto* childP: objectP->children()) {
activateLayoutsRecursive(childP);
}

QWidget*
widgetP(dynamic_cast(objectP));

if (widgetP) {
widgetP->updateGeometry();

QLayout*layoutP(widgetP->layout());

if (layoutP) {
layoutP->invalidate();
layoutP->update();
layoutP->activate();
}
}
}
}


> On May 27, 2024, at 1:07 AM, Tony Rietwyk  wrote:
> 
> Hi Dave,
> 
> I have had a similar issue at various times, especially in Qt4, but not as 
> much in Qt5 & 6.  A few places still had problems when adjusting after 
> creating or deleting widgets, or switching pages in an embedded page control. 
>  This is the routine I use:
> 
> void activateLayoutsRecursive(QWidget *w)
> {
> if (w)
> {
> // Depth first traversal. 
> for (auto k : w->children())
> {
> if (auto z = qobject_cast(k))
> activateLayoutsRecursive( z );
> }
> 
> if (w->layout())
> {
> w->layout()->invalidate();
> w->layout()->activate();
> //qCDebug(lc) << w->objectName() << 
> w->layout()->totalMinimumSize();
> }
> }
> }
> 
> I hope that helps!

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