70 lines
1.3 KiB
C++
70 lines
1.3 KiB
C++
|
#include <QtWidgets/QtWidgets>
|
|||
|
#include <QtWidgets/QApplication>
|
|||
|
#include "Widgets/MainFrame/QMainFrame.h"
|
|||
|
|
|||
|
int main( int argc, char * argv[] )
|
|||
|
{
|
|||
|
QApplication * pApp = nullptr;
|
|||
|
QMainFrame * pMainFrame = nullptr;
|
|||
|
int returnCode = -1;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
pApp = new QApplication( argc, argv );
|
|||
|
}
|
|||
|
catch ( ... )
|
|||
|
{
|
|||
|
QMessageBox::critical( nullptr,
|
|||
|
"错误!",
|
|||
|
"创建QApplication错误!\n请联系开发人员。" );
|
|||
|
|
|||
|
return -1;
|
|||
|
}
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
pMainFrame = new QMainFrame();
|
|||
|
}
|
|||
|
catch ( std::runtime_error & error )
|
|||
|
{
|
|||
|
QMessageBox::critical( nullptr,
|
|||
|
"错误!",
|
|||
|
error.what() );
|
|||
|
|
|||
|
return -1;
|
|||
|
}
|
|||
|
catch ( ... )
|
|||
|
{
|
|||
|
QMessageBox::critical( nullptr,
|
|||
|
"错误!",
|
|||
|
"创建窗口过程错误!\n请联系开发人员。" );
|
|||
|
|
|||
|
return -1;
|
|||
|
}
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
pMainFrame->showMaximized();
|
|||
|
|
|||
|
returnCode = pApp->exec();
|
|||
|
}
|
|||
|
catch ( std::runtime_error & error )
|
|||
|
{
|
|||
|
QMessageBox::critical( nullptr,
|
|||
|
"错误!",
|
|||
|
error.what() );
|
|||
|
|
|||
|
return -1;
|
|||
|
}
|
|||
|
catch ( ... )
|
|||
|
{
|
|||
|
QMessageBox::critical( nullptr,
|
|||
|
"错误!",
|
|||
|
"创建窗口过程错误!\n请联系开发人员。" );
|
|||
|
|
|||
|
return -1;
|
|||
|
}
|
|||
|
|
|||
|
return returnCode;
|
|||
|
}
|