Humberto Pinheiro
Humberto Pinheiro

Reputation: 1174

Qt widgets added at runtime aren't shown

I'm trying to put a new customized widget when the user press a button, using layout->addWidget(mywidget) where layout is a QVBoxLayout, but it's not working.

Tried: - Passing this to the widget constructor as parent - Passing the layout pointer as the parent - Passing 0 as the parent - The scrollArea pointer where the customized widget should be in as the parent

None works. When layout->addWidget is called in the constructor it works though.

Upvotes: 1

Views: 4335

Answers (1)

Humberto Pinheiro
Humberto Pinheiro

Reputation: 1174

Nevermind, just use widget->show() and everything goes fine. Weird, qt should do this by default, no?

Upvotes: 3

Related Questions