• 2819阅读
  • 1回复

请教个问题 [复制链接]

上一主题 下一主题
离线smallcsduck
 

只看楼主 倒序阅读 楼主  发表于: 2015-05-13

#include "widget.h"
#include <QApplication>
#include "connection.h"
#include "logindialog.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    if(!createConnection()||!createXml())return 0;
    Widget w;
    LoginDialog dlg;
    if(dlg.exec()==QDialog::Accepted){
        w.show();
        return a.exec();
    }else{
        return 0;
    }
}
为什么不用 dlg.show()?
离线dosmlp

只看该作者 1楼 发表于: 2015-05-13
int QDialog::exec() [virtual slot]

Shows the dialog as a modal dialog, blocking until the user closes it. The function returns a DialogCode result.

If the dialog is application modal, users cannot interact with any other window in the same application until they close the dialog. If the dialog is window modal, only interaction with the parent window is blocked while the dialog is open. By default, the dialog is application modal.

多看文档啊,文档可以解决很多问题
快速回复
限100 字节
 
上一个 下一个