Labels

16/07/2009

Create second window/form/dialog

(新建窗口)

Add New.. Qt – Qt Designer Form ClassNeed to include newform.h in mainwindow.cpp file where has slot to open this new window;Add "extern newDialog *newdialog" in mainwindow.cpp;Add"newDialog *newdialog"in newwindow.cpp;

show() does not block, so you'll only see a quick flash of your dialog, as it'll be destroyed immediately after calling show() ( when exiting the method ). Using exec() blocks until dialog is closed by the user.

if create new a window/dialog by using code, and did not pre-create window/dialog from “add new.. QT Designer form class”, the new window/dialog may be no shows on the top. This is because that the new window/dialog does not have a parent window/dialog. In order to make sure the new window/dialog shows on the top, use “add new.. QT Designer form class” create a new window/dialog first.