add QT5 support

This commit is contained in:
2020-07-01 16:23:51 +08:00
parent 9b1975a8a5
commit 165e95c0d5
9 changed files with 248 additions and 1 deletions

28
inc/hgl/platform/QT5.h Normal file
View File

@@ -0,0 +1,28 @@
#ifndef HGL_QT5_MAIN_INCLUDE
#define HGL_QT5_MAIN_INCLUDE
#include<hgl/platform/QT5Application.h>
#include<hgl/platform/ConsoleSystemInitInfo.h>
#define HGL_QT_MAIN(sii_name,app_name,arg_name) extern "C" int QT5AppMain(hgl::ConsoleSystemInitInfo &sii_name,hgl::QT5GuiApplication &app_name,const hgl::StringList<hgl::OSString> &arg_name)
#define QTConnect(obj,event,class_pointer,slot_func) connect(obj,SIGNAL(event()),class_pointer,SLOT(slot_func()))
#define HGL_QT_MAIN_FUNC() HGL_QT_MAIN(sii,app,args)
#define HGL_QT_APPLICATION(name,code,start) using namespace hgl; \
\
HGL_QT_MAIN_FUNC()\
{ \
sii.info.ProjectName=name; \
sii.info.ProjectCode=code; \
\
if(!app.Init(&sii)) \
return(-1); \
\
app.SetStart(start); \
\
return app.Run(); \
}
#endif//HGL_QT5_MAIN_INCLUDE

View File

@@ -0,0 +1,33 @@
#ifndef HGL_QT5_APPLICATION_INCLUDE
#define HGL_QT5_APPLICATION_INCLUDE
#include<hgl/QT.h>
class QApplication;
#include<hgl/platform/ConsoleApplication.h>
namespace hgl
{
class QT5GuiApplication:public ConsoleApplication
{
QApplication *qt_app;
public:
QT5GuiApplication(QApplication *);
~QT5GuiApplication();
int exec();
};//class QT5GuiApplication
}//namespace hgl
/**
* 控制台程序总入口函数
* @param sii 系统初始化信息类,需由开发者补充填写一定的信息
* @param app 应用程序整体控制管理类
* @param args 由命令行或其它程序传来的参数列表
* @return 返回值,将会回传给操作系统
*/
extern "C" int QT5AppMain(hgl::ConsoleSystemInitInfo &sii,hgl::QT5GuiApplication &app,const hgl::StringList<hgl::OSString> &args);
#endif//HGL_QT5_APPLICATION_INCLUDE