PDA

View Full Version : widget swap/widget on top



ad3d
27th July 2011, 06:52
Hi guys,

if i press a button on mainwindow i want another widget i.e. widget1 to popup, but that widget1 should be on top and the mainwindow should be disabled.. same should happen if i try to open a new widget i.e. widget2 by pressing a button on widget1 (widget 2 should be on top and other 2 widgets should be disabled)

in this process i dont want to hide the disabled widgets/windows..

Can someone plz guide me to achieve the same..

Thanx in advance

Regards,
ad3d

NullPointer
27th July 2011, 07:01
Hello,

Try using a QDialog instead of a QWidget, then use QDialog::exec();

HTH. :)

Talei
27th July 2011, 07:12
exec() in QDialog serves a purpose of showing dialog as modal widget.
To achieve the same effect but using QWidget set modality parameter. Something along this line should help You:


QWidget *w = new QWidget( this, Qt::Window );
w->setWindowModality( Qt::ApplicationModal );
w->show();
This will create modal widget, all mouse.keyboard input are redirected to this widget.

ad3d
27th July 2011, 10:40
But while using modality one must HIDE and SHOW the widgets...

I need to Disable the Widget Background and keep the Top level widget enabled..

Talei
27th July 2011, 16:58
You don't hide anything, just create new widget, with is by default hidden/invisible/unpainted into screen, and then show it.


I need to Disable the Widget Background and keep the Top level widget enabled..
Please help Us help You. Describe Your problem best You can, and If that's necessary add pix into post for better understanding. Currently I don't know where is your problem, and I think the solution that was posted is what You're looking for.