The invalidate()
worked for me.
Notice that if you do the following it would work as asked here (at least it seems to be fine in my code):
widget->show();
widget->layout()->invalidate();
widget->hide();
This doesn't show the widget on the screen since you don't relinquish control back to the queue until the hide()
happens. In between, the invalidate()
computes the correct positions.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…