PDA

View Full Version : Precent QDialog from de-activating mainwindow



Arthur
6th October 2010, 12:01
Hello,

I have a simple Win32 application, with mainwindow hWnd. Nothing special, just a sample Win32 app with a main window created with the VC++ 2005 wizard.

Then I added this:



QWinWidget * pWinWidget_ = new QWinWidget(hWnd);
QDialog * pDialog_ = new QDialog(pWinWidget_, Qt::FramelessWindowHint);
pDialog_->setWindowModality(Qt::NonModal);
pDialog_->setLayout(new QGridLayout() );

QTextEdit * pTextEdit_ = new QTextEdit(pDialog_);
pDialog_->layout()->setMargin(0);
pDialog_->layout()->addWidget(pTextEdit_);

pTextEdit_->show();
pDialog_->show();


When clicking the editbox, the mainwindow will de-activate. In other words: to minimize it, I have to click twice on the mainwindow. 1 time to activate the main window and 1 time to minimize it.

I want the dialog to behave modeless and it must - not - deactivate the parent.

Is that possible?

Arthur