PDA

View Full Version : Help me about showNormal in QWorkspace



vql
24th October 2006, 13:34
I create 2 windows (class MyWidget inherited from QWidget) and add to QWorkspace. I have a question:


MyWidget *widget1 = new QWidget(this);
workspace->addWidget(widget1);
widget1->showMaximize();

MyWidget *widget2 = new QWidget(this);
workspace->addWidget(widget2);
widget2->showNormal();

If i show in order: widget1, widget2; widget2 allways show in maximize although i use widget2->showNormal(). I know this problem: the after window is affected by the before window. If workspace doesn't have any windows, i show widget2 first, widget2 will show normal. I need a help: if i open widget1 in maximize, then i show widget2 in normal and it allway show normal and it is affected by the before window.

Thanks

wysota
24th October 2006, 21:52
Try something like this:

QWidget *active = workspace->activeWindow();
if(active && active->isMaximized()) active->showNormal();
workspace->addWidget(widget2);
widget2->showNormal();