Tried that too, to no avail

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

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

                QWidget*                
widgetP(dynamic_cast<QWidget*>(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 <t...@rightsoft.com.au> 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<QWidget *>(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

Reply via email to