QGC的MainWindow的menuWidget

QGC的MainWindow的menuWidget_第1张图片

MainWindow::_buildCommonWidgets(void)

QGC主界面的菜单栏

第二个菜单栏

第一个action

//ui/MainWindow.cc
#ifdef UNITTEST_BUILD
    QAction * qmlTestAction=new QAction("Test QML palette and controls",NULL);
    connect(qmlTestAction,QAction::triggered,this,&MainWindow::_showQmlTestWidget);
    _ui.menuWidgets->addAction(qmlTestAction);

剩下6个action

//ui/MainWindow.cc
static const char *rgDockWidgetNames[] = {
    "MAVLink Inspector",
    "Custom Command",
    "Onboard Files",
    "Deprecated Widget",
    "HIL Config",
    "Analyze"
};

void MainWindow::_buildCommonWidgets(void){
    logPlayer=new QGCMAVLinkLogPlayer(statusBar());
    statusBar()->addPermanentWidget(logPlayer);
    for(int i=0,end=ARRAY_SIZE(rgDockWidgetNames);iconst char *pDockWidgetName=rgDockWidgetNames[i];
    //Add to menu
    QAction *action=new QAction(pDockWidgetName,this);
    action->setCheckable(true);
    action->setData(i);
    connect(action,QAction::triggered,this,&MainWindow::_showDockWidgetAction);
    _ui.menuWidgets->addAction(action);
    _mapName2Action[pDockWidgetName]=action;
}


。


QGCApplication *app=new QGCApplication();
...
在构造函数中,app->init
主要是注册了一对qmlRegiasterType
app->_initNormalAppBoot()
调用了MainWindow->create()创建窗口







你可能感兴趣的:(QGC)