I don't have a problem in above code, but I encountered strange behaviour when the code was simplified (as I already described it). I want to be convinced that this behaviour isn't insane or that it is just a bug.
First of all, IMO there is no need for repaint()/update() (or even: it shoudn't be needed here), because geometry is changed, so paintEvent() will be invoked anyway. But it isn't invoked if we're setting geometry as it was before we've zeroed it. That's the problem. Actually removing show()/hide()/setVisible() doesn't change the situation (it's just a matter of taste - I prefer having hidden window when its width is zero).
QWidget::repaint() does not help here.
Bookmarks