Advertisement
Guest User

Untitled

a guest
May 25th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <QtGui/QApplication>
  2. #include "mainwindow.h"
  3. #include <QTextCodec> //添加头文件
  4. #include "logindlg.h" //添加头文件
  5. int main(int argc, char *argv[])
  6. {
  7. QApplication a(argc, argv);
  8. // QTextCodec::setCodecForTr(QTextCodec::codecForLocale()); //设置编码
  9. QTextCodec::setCodecForTr(QTextCodec::codecForName("GB2312"));
  10. MainWindow w;
  11. LoginDlg dlg; // 建立自己新建的类的对象dlg
  12. if(dlg.exec() == QDialog::Accepted) // 利用Accepted返回值判断按钮是否被按下
  13. {
  14. w.show(); // 如果被按下,显示主窗口
  15. return a.exec(); // 程序一直执行,直到主窗口关闭
  16. }
  17. else return 0; //如果没被按下,则不会进入主窗口,整个程序结束运行
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement