版本信息
| 软件 | 版本 |
|---|---|
| QGC | V3.4 |
| Qt | 5.11.0 |
| Visual Studio | 2015 |
软件架构
// main.cc内209行
QGCApplication* app = new QGCApplication(argc, argv, runUnitTests)
QGCApplication在QGCApplication.h内定义。
QGCApplication是QGC数据交互的主体,QGC将相关的类在其中构造并将App作为一个全局的静态变量通过qgcApp()来访问。
QGCApplication.cc内定义qgcApp()。
/// @brief Returns the QGCApplication object singleton.
QGCApplication* qgcApp(void)
{
return QGCApplication::_app;
}
在该类的QGCApplication的_initCommon()实现名称为QGroundControlQmlGlobal的单例,也就是qml文件中常常看到的QgroundControl 1.0模块,通过该单例,可以在qml中访问C++的接口和一些属性信息。
void QGCApplication::_initCommon(void)
{
QSettings settings;
// Register our Qml objects
qmlRegisterType<QGCPalette> ("QGroundControl.Palette", 1, 0, "QGCPalette");
qmlRegisterType<QGCMapPalette> ("QGroundControl.Palette", 1, 0, "QGCMapPalette");
qmlRegisterUncreatableType<CoordinateVector> ("QGroundControl", 1, 0, "CoordinateVector", "Reference only");
qmlRegisterUncreatableType<QmlObjectListModel> ("QGroundControl", 1, 0, "QmlObjectListModel", "Reference only");
qmlRegisterUncreatableType<MissionCommandTree> ("QGroundControl", 1, 0, "MissionCommandTree", "Reference only");
qmlRegisterUncreatableType<CameraCalc> ("QGroundControl", 1, 0, "CameraCalc", "Reference only");
qmlRegisterUncreatableType<AutoPilotPlugin> ("QGroundControl.AutoPilotPlugin", 1, 0, "AutoPilotPlugin", "Reference only");
qmlRegisterUncreatableType<VehicleComponent> ("QGroundControl.AutoPilotPlugin", 1, 0, "VehicleComponent", "Reference only");
qmlRegisterUncreatableType<Vehicle> ("QGroundControl.Vehicle", 1, 0, "Vehicle", "Reference only");
qmlRegisterUncreatableType<MissionItem> ("QGroundControl.Vehicle", 1, 0, "MissionItem", "Reference only");
qmlRegisterUncreatableType<MissionManager>

本文详细介绍了QGC(一款开源地面站软件)的应用架构及其实现机制,包括软件版本信息、核心类QGCApplication的设计原理及其与qml的交互方式,为开发者提供了深入理解QGC内部工作原理的基础。
最低0.47元/天 解锁文章
8749

被折叠的 条评论
为什么被折叠?



