PDA

View Full Version : QDialog and setModal



ruscoff
3rd October 2013, 11:54
Hi all,
I'm programming with QT 4.8.4, and i need to show modal dialog.

I develop an QDialog frameless window with setModal(true). It's show correctly but mouse press position are wrong: if i put QPushButton as children of Dialog i can't click it correctly, seems there is an offset of 10px into mouse position.

This is how i show window: (show method is ovveride)


MenuPopupDialog *dlg = new MenuPopupDialog(this);
dlg->setWindowTitle("Menù");
dlg->setModal(true);
dlg->show(QSize(500,700));


But if i set setModal(false) and windowsFlag to frameless window + Popup mouse work correctly.

How can i resolve?

Thanks

Marco

Added after 1:

Another code problem:



QDialog *dlg = new QDialog(this);
QPushButton *btn = new QPushButton(dlg);
btn->setGeometry(20,20,50,50);
dlg->setModal(true);
dlg->show()
;

Try this cose, you will be not able to push the button, why?

Thanks

ruscoff
7th October 2013, 17:23
I found the problem:
I intercept WM_NCACTIVATE and set it always to True,thats means main windows always activate.
To work correctly QT need only one window actived, so i've to set WM_NCACTIVATE to False when required.