PDA

View Full Version : QDockWidget magically disapear



1111
29th January 2009, 11:36
Hi all,

I found quite strange behavior of QDockWidget or maybe it is default behavior.

Anyway, I have main window with QStackedWidget inside, one widget in QStackedWidget contains QDockWidget. By default QDockWidget visible for a user and shown on the screen, but if user switch to another widget in QStackedWidget and then back, QDockWidget disapear. It won't be destroyed but closed. Event if I disable close feature in QDockWidget it still disappear if you switch widgets.

So is it default widget behavior and if yes, how can I force QDockWidget stay on the screen?

aamer4yu
29th January 2009, 12:44
Anyway, I have main window with QStackedWidget inside, one widget in QStackedWidget contains QDockWidget.

That explains the behaviour. StackWidget is supposed to show one widget at a time. You DONT need to add dock widget to stack widget.

You are required to add dock widget to main window, see QMainWindow::addDockWidget