qt Popup modal dialog box procedure:
1, the new UI file, be sure to choose the base class is Qdialog, my choice is: Dialog without Buttons (), such as:
2, and then in use:
Mydialog Dlg (this);
Dlg.exec ();
If this is not added, a new EXE is created in the Task Manager.
3, if the title of the dialog box is custom, do not want to use the system's title, this time need to add in the code:
Setwindowflags (Qt::D ialog | Qt::framelesswindowhint);
SetAttribute (Qt::wa_translucentbackground);
When setting the window flag, be sure to add: Qt::D ialog, otherwise the dialog box pop-up is not in the form of modal dialog box, will become a non-modal dialog box.
Attached: modal dialog box Custom caption with transparent shaded border:
Main ideas:
1. A widget control is placed on the dialog box, which is used to store the background image;
2, the dialog box is set to untitled, no minimum button style, and the background is completely transparent;
In the dialog box class, initialize join:
Setwindowflags (Qt::D ialog | Qt::framelesswindowhint);
SetAttribute (Qt::wa_translucentbackground);
Set the widget background chart in the UI file, which is a picture with a shaded border:
#widget {Border-image:url (:/images/bk.png)}
http://blog.csdn.net/itjobtxq/article/details/8797360
Qt modal dialog box usage (set widget background in UI file, this is a picture with a shaded border--cool)