void WeatherParamSetupWidget::onAirportChanged(int index){
    disconnect(planeNameComboBox, SIGNAL(currentTextChanged(QString)), this, SLOT(onPlaneNameChanged(QString)));
    planeNameComboBox->clear();
    Airport airport = airportList[index];
    QStringList planeNameList = airport.planeName().split(",", QString::SkipEmptyParts);
    planeNameComboBox->addItems(planeNameList);
    connect(planeNameComboBox, SIGNAL(currentTextChanged(QString)), this, SLOT(onPlaneNameChanged(QString)));
    this->onPlaneNameChanged(planeNameList[0]);
}
void WeatherParamSetupWidget::initUI(){
    this->setWindowFlags(Qt::WindowCloseButtonHint);
    this->setFixedWidth(440);
    this->setFixedHeight(500);

    this->setWindowIcon(QIcon(":/images/weather_setup.png"));
    this->setWindowTitle("阀值设置");

    //设置机场
    airportComboBox = new QComboBox;
    airportComboBox->addItems(apNameList);
    //设置机型
    planeNameComboBox = new QComboBox;
    if(airportList.size() > 0){
        Airport airport = airportList[airportComboBox->currentIndex()];
        QStringList planeNameList = airport.planeName().split(",", QString::SkipEmptyParts);
        planeNameComboBox->addItems(planeNameList);
    }
    //设置标签
    tabWidget = new QTabWidget;
    tabWidget->setContentsMargins(5, 5, 5, 5);
    if(apNameList.size() > 0){
        multiWeatherParamWidget = new MultiWeatherParamWidget;
        multiWeatherParamWidget->onAirportChanged(apCodeList[airportComboBox->currentIndex()], planeNameComboBox->currentText());
        tabWidget->addTab(multiWeatherParamWidget, "多要素");
        singleWeatherParamWidget = new SingleWeatherParamWidget;
        singleWeatherParamWidget->onAirportChanged(apCodeList[airportComboBox->currentIndex()], planeNameComboBox->currentText());
        tabWidget->addTab(singleWeatherParamWidget, "单要素");
    }
    //布局
    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(airportComboBox);
    mainLayout->addWidget(planeNameComboBox);
    mainLayout->addWidget(tabWidget);

    //设置上一步下一步按钮
    if(SharedMemory::isWelcome){
        previousButton = new QPushButton;
        previousButton->setText("上一步");

        nextButton = new QPushButton;
        nextButton->setText("下一步");

        QHBoxLayout *hlayout = new QHBoxLayout;
        hlayout->addWidget(previousButton);
        hlayout->addStretch();
        hlayout->addWidget(nextButton);

        mainLayout->addLayout(hlayout);
    }

    this->setLayout(mainLayout);
}