当前位置: 首页>>代码示例>>C++>>正文


C++ QComboBox::setItemData方法代码示例

本文整理汇总了C++中QComboBox::setItemData方法的典型用法代码示例。如果您正苦于以下问题:C++ QComboBox::setItemData方法的具体用法?C++ QComboBox::setItemData怎么用?C++ QComboBox::setItemData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QComboBox的用法示例。


在下文中一共展示了QComboBox::setItemData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QComboBox

QMultiMap<int, IOptionsDialogWidget *> StatusIcons::optionsDialogWidgets(const QString &ANodeId, QWidget *AParent)
{
	QMultiMap<int, IOptionsDialogWidget *> widgets;
	if (FOptionsManager!=NULL && ANodeId==OPN_APPEARANCE)
	{
		QComboBox *cmbStatusIcons = new QComboBox(AParent);
		cmbStatusIcons->setItemDelegate(new IconsetDelegate(cmbStatusIcons));

		int index = 0;
		for (QMap<QString, IconStorage *>::const_iterator it=FStorages.constBegin(); it!=FStorages.constEnd(); ++it)
		{
			QString name = it.value()->storageProperty(FILE_STORAGE_NAME,it.key());
			cmbStatusIcons->addItem(it.value()->getIcon(SIK_ONLINE),name,it.key());

			cmbStatusIcons->setItemData(index,it.value()->storage(),IconsetDelegate::IDR_STORAGE);
			cmbStatusIcons->setItemData(index,it.value()->subStorage(),IconsetDelegate::IDR_SUBSTORAGE);
			cmbStatusIcons->setItemData(index,true,IconsetDelegate::IDR_HIDE_STORAGE_NAME);

			index++;
		}
		cmbStatusIcons->model()->sort(0);

		widgets.insertMulti(OHO_APPEARANCE_ROSTER, FOptionsManager->newOptionsDialogHeader(tr("Contacts list"),AParent));
		widgets.insertMulti(OWO_APPEARANCE_STATUSICONS, FOptionsManager->newOptionsDialogWidget(Options::node(OPV_STATUSICONS_DEFAULT),tr("Status icons:"),cmbStatusIcons,AParent));
	}
	return widgets;
}
开发者ID:ZerGabriel,项目名称:vacuum-im,代码行数:27,代码来源:statusicons.cpp

示例2: throwConfigError

/**
   This function displays text and color formatting in order to help the user understand what channels have not yet been configured.
 */
bool ConfigFixedWingWidget::throwConfigError(QString airframeType)
{
    // Initialize configuration error flag
    bool error = false;

    QList<QComboBox *> comboChannelsName;
    comboChannelsName << m_aircraft->fwEngineChannelBox
                      << m_aircraft->fwAileron1ChannelBox << m_aircraft->fwAileron2ChannelBox
                      << m_aircraft->fwElevator1ChannelBox << m_aircraft->fwElevator2ChannelBox
                      << m_aircraft->fwRudder1ChannelBox << m_aircraft->fwRudder2ChannelBox;
    QString channelNames = "";

    for (int i = 0; i < 7; i++) {
        QComboBox *combobox = comboChannelsName[i];
        if (combobox && (combobox->isEnabled())) {
            if (combobox->currentText() == "None") {
                int size = combobox->style()->pixelMetric(QStyle::PM_SmallIconSize);
                QPixmap pixmap(size, size);
                if ((airframeType == "FixedWingElevon") && (i > 2)) {
                    pixmap.fill(QColor("green"));
                    // Rudders are optional for elevon frame
                    combobox->setToolTip(tr("Rudders are optional for Elevon frame"));
                } else if (((airframeType == "FixedWing") || (airframeType == "FixedWingVtail")) && (i == 2)) {
                    pixmap.fill(QColor("green"));
                    // Second aileron servo is optional for FixedWing frame
                    combobox->setToolTip(tr("Second aileron servo is optional"));
                } else if ((airframeType == "FixedWing") && (i > 3)) {
                    pixmap.fill(QColor("green"));
                    // Second elevator and rudders are optional for FixedWing frame
                    combobox->setToolTip(tr("Second elevator servo is optional"));
                    if (i > 4) {
                        combobox->setToolTip(tr("Rudder is highly recommended for fixed wing."));
                    }
                } else {
                    pixmap.fill(QColor("red"));
                    combobox->setToolTip(tr("Please assign Channel"));
                    m_aircraft->fwStatusLabel->setText(tr("<font color='red'>ERROR: Assign all necessary channels</font>"));
                    error = true;
                }
                combobox->setItemData(0, pixmap, Qt::DecorationRole); // Set color palettes
            } else if (channelNames.contains(combobox->currentText(), Qt::CaseInsensitive)) {
                int size = combobox->style()->pixelMetric(QStyle::PM_SmallIconSize);
                QPixmap pixmap(size, size);
                pixmap.fill(QColor("orange"));
                combobox->setItemData(combobox->currentIndex(), pixmap, Qt::DecorationRole); // Set color palettes
                combobox->setToolTip(tr("Channel already used"));
                error = true;
            } else {
                for (int index = 0; index < (int)ConfigFixedWingWidget::CHANNEL_NUMELEM; index++) {
                    combobox->setItemData(index, 0, Qt::DecorationRole); // Reset all color palettes
                    combobox->setToolTip("");
                }
            }
            channelNames += (combobox->currentText() == "None") ? "" : combobox->currentText();
        }
    }
    return error;
}
开发者ID:Indianberries,项目名称:LibrePilot,代码行数:61,代码来源:configfixedwingwidget.cpp

示例3: updateParameterTable

void AtenPrefs::updateParameterTable()
{
	if (!isVisible()) return;
	Messenger::enter("AtenPrefs::updateParameterTable");
	int row = ui.FunctionalFormList->currentRow();
	if (row == -1)
	{
		ui.ParameterTable->setRowCount(0);
		Messenger::exit("AtenPrefs::updateParameterTable");
		return;
	}
	int n;
	QStringList combrules;
	QComboBox* combo;
	QTableWidgetItem *item;
	for (n=0; n<CombinationRules::nCombinationRules; ++n) combrules << CombinationRules::combinationRuleName( (CombinationRules::CombinationRule) n);
	ui.ParameterTable->setColumnCount(2);
	ui.ParameterTable->setRowCount(VdwFunctions::functionData[row].nParameters);
	for (n=0; n<VdwFunctions::functionData[row].nParameters; ++n)
	{
		item = new QTableWidgetItem(VdwFunctions::functionData[row].parameters[n]);
		ui.ParameterTable->setItem(n, 0, item);
		combo = new QComboBox(this);
		combo->setMinimumSize(78,24);
		combo->addItems(combrules);
		combo->setItemData(0, n);
		combo->setCurrentIndex(VdwFunctions::functionData[row].combinationRules[n]);
		ui.ParameterTable->setCellWidget(n, 1, combo);
		QObject::connect(combo, SIGNAL(activated(int)), this, SLOT(ParameterRuleChanged(int)));
	}
	Messenger::exit("AtenPrefs::updateParameterTable");
}
开发者ID:alinelena,项目名称:aten,代码行数:32,代码来源:prefs_funcs.cpp

示例4: addCbLayer

void QgsSpatialQueryDialog::addCbLayer( bool isTarget, QgsVectorLayer* lyr )
{
  QVariant item = QVariant::fromValue(( void * )lyr );
  QComboBox * cmb = isTarget ? cbTargetLayer : cbReferenceLayer;
  int idNew = cmb->count();
  QIcon icon = getIconTypeGeometry( lyr->geometryType() );
  cmb->addItem( icon, lyr->name(), item );
  cmb->setItemData( idNew, QVariant( lyr->source() ), Qt::ToolTipRole );
} // void QgsSpatialQueryDialog::removeLayerCombobox(bool isTarget, QgsVectorLayer* lyr)
开发者ID:AaronGaim,项目名称:QGIS,代码行数:9,代码来源:qgsspatialquerydialog.cpp

示例5: createEditor

QWidget* SettingsDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
    if (index.data().type() == QVariant::Color) {
        QComboBox* comboBox = new QComboBox(parent);
        comboBox->addItems(svgColorNames());
        comboBox->setEditable(true);
        int i = 0;
        foreach (const QString& color, svgColorNames())
            comboBox->setItemData(i++, QColor(color), Qt::DecorationRole);
        return comboBox;
    } else if (index.data().type() == QVariant::Font) {
开发者ID:c3c,项目名称:quazaa,代码行数:11,代码来源:settingsdelegate.cpp

示例6: QString

void GCF::Components::EnumEditorCreator::initialize(QWidget* editor, QMetaEnum enumStruct)
{
    QComboBox* combo = qobject_cast<QComboBox*>(editor);
    if(!combo)
        return;

    for(int i=enumStruct.keyCount()-1; i>=0; i--)
    {
        QString key = QString("%1").arg(enumStruct.key(i));
        int value = enumStruct.value(i);
        combo->insertItem(0, key);
        combo->setItemData(0, value);
    }
}
开发者ID:banduladh,项目名称:levelfour,代码行数:14,代码来源:ValueEditorCreators.cpp

示例7: createEditor

QWidget* QUDefaultDelegate::createEditor(
		QWidget *parent,
		const QStyleOptionViewItem &/*option*/,
		const QModelIndex &/*index*/) const
{
	QComboBox *editor = new QComboBox(parent);

	editor->addItems(QUAudioTagTask::availableSpecialSources());
	for(int i = 0; i < editor->count(); i++)
		editor->setItemData(i, Qt::darkGray, Qt::ForegroundRole);

	editor->setEditable(true);

	return editor;
}
开发者ID:escaped,项目名称:uman,代码行数:15,代码来源:QUDefaultDelegate.cpp

示例8: setEditorData

void ComboUsersDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
     Q_UNUSED(index);
     QComboBox * combo = static_cast<QComboBox*>(editor);
     QMapIterator<QString,QString> it(m_mapUsers);
     int row = 0;
     while (it.hasNext())
     {
         it.next();
         QString login = it.key();
         QString prat = it.value();
         combo->addItem(login);
         combo->setItemData(row,prat,Qt::ToolTipRole);
         ++row;
         }
}
开发者ID:jeromecc,项目名称:FreeAccounting,代码行数:16,代码来源:delegate.cpp

示例9: AddComboBoxItemForElement

    void AddComboBoxItemForElement( QComboBox& comboBox,
                                    const WbConfig::SubConfigs::ValueIdPair& element )
    {
        const QString elementName( element
                                       .value
                                       .GetKeyValue( WbDefaultKeys::displayNameKey )
                                       .ToQString() );

        comboBox.addItem( elementName, QVariant( element.id ) );
        comboBox.setItemData( comboBox.count()-1,
                              element
                                 .value
                                 .GetKeyValue( WbDefaultKeys::descriptionKey )
                                 .ToQString(),
                              Qt::ToolTipRole );
    }
开发者ID:Bullatov,项目名称:gts,代码行数:16,代码来源:WbConfigTools.cpp

示例10: updatePhaseComboBoxes

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void PhaseTypeSelectionWidget::updatePhaseComboBoxes()
{
  bool ok = false;
  // setup the list of choices for the widget
  PhaseTypeSelectionFilterParameter* phaseTypes = dynamic_cast<PhaseTypeSelectionFilterParameter*>(getFilterParameter());
  QString countProp = phaseTypes->getPhaseTypeCountProperty();
  int phaseCount = getFilter()->property(countProp.toLatin1().constData()).toInt(&ok);
  QString phaseDataProp = phaseTypes->getPhaseTypeDataProperty();

  UInt32Vector_t vectorWrapper = getFilter()->property(phaseDataProp.toLatin1().constData()).value<UInt32Vector_t>();
  QVector<quint32> dataFromFilter = vectorWrapper.d;
  if(phaseCount < 0 && dataFromFilter.size() < 10)   // there was an issue getting the phase Count from the Filter.
  {
    phaseCount = dataFromFilter.size(); // So lets just use the count from the actual phase data
  }

  // Get our list of predefined enumeration values
  QVector<unsigned int> phaseTypeEnums;
  PhaseType::getPhaseTypeEnums(phaseTypeEnums);

  phaseListWidget->clear();
  // Get our list of Phase Type Strings
  QStringList phaseListChoices = m_FilterParameter->getPhaseListChoices();

  for (int i = 1; i < phaseCount; i++)
  {
    QComboBox* cb = new QComboBox(NULL);
    for (int s = 0; s < phaseListChoices.size(); ++s)
    {
      cb->addItem((phaseListChoices[s]), phaseTypeEnums[s]);
      cb->setItemData(static_cast<int>(s), phaseTypeEnums[s], Qt::UserRole);
    }

    QListWidgetItem* item = new QListWidgetItem(phaseListWidget);
    phaseListWidget->addItem(item);
    phaseListWidget->setItemWidget(item, cb);

    if (i < dataFromFilter.size())
    {
      cb->setCurrentIndex(dataFromFilter[i]);
    }
    connect(cb, SIGNAL(currentIndexChanged(int)),
            this, SLOT(phaseTypeComboBoxChanged(int)) );
  }
}
开发者ID:kglowins,项目名称:DREAM3D,代码行数:48,代码来源:PhaseTypeSelectionWidget.cpp

示例11: switch

void Utente::SearchFunctor::operator () (const SmartUtente& x, QTableWidget* tw) const {
    switch(searchType) {
        case 1:
            tw->insertRow(tw->rowCount());
            tw->setItem(tw->rowCount()-1,0,new QTableWidgetItem(x.u->un.login));
            tw->setItem(tw->rowCount()-1,1,new QTableWidgetItem(((x.u)->pf).getProfilo()->getNome()));
            tw->setItem(tw->rowCount()-1,2,new QTableWidgetItem(((x.u)->pf).getProfilo()->getCognome()));
            tw->setMinimumWidth(420);
            break;
        case 2:
            tw->insertRow(tw->rowCount());
            tw->setItem(tw->rowCount()-1,0,new QTableWidgetItem(x.u->un.login));
            tw->setItem(tw->rowCount()-1,1,new QTableWidgetItem(((x.u)->pf).getProfilo()->getNome()));
            tw->setItem(tw->rowCount()-1,2,new QTableWidgetItem(((x.u)->pf).getProfilo()->getCognome()));
            tw->setItem(tw->rowCount()-1,3,new QTableWidgetItem(((x.u)->pf).getProfilo()->getEmail()));
            tw->setColumnWidth(3,140);
            tw->setMinimumWidth(560);
            break;
        case 3:
        {
            tw->insertRow(tw->rowCount());
            tw->setItem(tw->rowCount()-1,0,new QTableWidgetItem(x.u->un.login));
            tw->setItem(tw->rowCount()-1,1,new QTableWidgetItem(((x.u)->pf).getProfilo()->getNome()));
            tw->setItem(tw->rowCount()-1,2,new QTableWidgetItem(((x.u)->pf).getProfilo()->getCognome()));
            tw->setItem(tw->rowCount()-1,3,new QTableWidgetItem(((x.u)->pf).getProfilo()->getEmail()));
            tw->setColumnWidth(3,180);
            QComboBox* cb = new QComboBox();
            cb->addItem("Lista contatti");
            int i=1;
            QList<Username>::const_iterator it = (((x.u)->rete)->net).begin();
            for( ; it != (((x.u)->rete)->net).end();  ++it,++i) {
                cb->addItem(it->login);
                cb->setItemData(i,0,Qt::UserRole - 1);
            };
            tw->setCellWidget(tw->rowCount()-1,4, cb);
            tw->setColumnWidth(4,140);
            tw->setMinimumWidth(740);
            break;
        }
        default:
            tw->insertRow(tw->rowCount());
            tw->setItem(tw->rowCount()-1,0,new QTableWidgetItem(x.u->un.login));
        }
}
开发者ID:Giava92,项目名称:LinQedIn,代码行数:44,代码来源:Utente.cpp

示例12: CarregaCombo

void Funcoes::CarregaCombo(QComboBox &combo, QString tabela, QString campo, QString valorPrimeiroIndice
                  , QString campoItemData, bool limparComboAntes, QString condicao)
{
    QSqlQuery sql( ConexaoBanco::Banco() );
    QString consulta;
    bool ok;

    consulta = "SELECT " + campo + ( campoItemData.isEmpty() ? "" : ", " + campoItemData )
            + " FROM " + tabela + ( condicao.isEmpty() ? "" : " WHERE " + condicao ) ;
    ok = sql.exec( consulta );

    if( !ok )
    {
        ErroSQL( sql, "funcoes.CarregaCombo<br><b>" + consulta + "</b></br>");
        return ;
    }

    if( limparComboAntes )
        combo.clear();

    if( !valorPrimeiroIndice.isEmpty() )
    {
        combo.clear();
        combo.addItem( valorPrimeiroIndice );
    }

    if( campoItemData.isEmpty() )
    {
        while( sql.next() )
        {
            combo.addItem( sql.record().value( campo ).toString() );
        }
    }
    else
    {
        while( sql.next() )
        {
            combo.addItem( sql.record().value( campo ).toString() );
            combo.setItemData( combo.count() - 1, sql.record().value( campoItemData ) );
        }
    }
}
开发者ID:escrifonife1,项目名称:Almoco,代码行数:42,代码来源:funcoes.cpp

示例13: query

MergeKholleursManager::MergeKholleursManager(QSqlDatabase* db, QList<Kholleur*>* anonymousKholleurs, QMap<QString, int>* idKholleurs, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::MergeKholleursManager)
{
    ui->setupUi(this);
    m_db = db;
    m_anonymousKholleurs = anonymousKholleurs;
    m_idKholleurs = idKholleurs;
    m_listKholleurs = new QList<Kholleur*>;

    // Get the kholleur
    QSqlQuery query(*m_db);
    query.exec("SELECT id, name, id_subjects, duration, preparation, pupils FROM tau_kholleurs ORDER BY UPPER(name)");
    while(query.next()) {
        Kholleur* k = new Kholleur();
        k->setId(query.value(0).toInt());
        k->setName(query.value(1).toString());
        k->setId_subjects(query.value(2).toInt());
        k->setDuration(query.value(3).toInt());
        k->setPreparation(query.value(4).toInt());
        k->setPupils(query.value(5).toInt());
        m_listKholleurs->append(k);
    }

    m_listComboBox = new QList<QComboBox*>;
    for(int i=0; i<m_anonymousKholleurs->length(); i++) {
        QHBoxLayout* row = new QHBoxLayout;
        row->addWidget(new QLabel("<font style=\"color:red;\">"+m_anonymousKholleurs->at(i)->getName()+"</font>"));
        QComboBox* box = new QComboBox;
        box->addItem("Ajouter ce nouveau kholleur", (qulonglong) 0);
        for(int j=0; j<m_listKholleurs->length(); j++) {
            box->addItem(m_listKholleurs->at(j)->getName(), (qulonglong) m_listKholleurs->at(j));
            box->setItemData(j+1, QColor(0,128,0), Qt::TextColorRole); // Green
        }
        m_listComboBox->append(box);
        row->addWidget(m_listComboBox->at(i));
        ui->centralLayout->insertLayout(i+2, row); // +2 : +1 for the spacer, +1 for the label
    }

    connect(ui->button_valid, SIGNAL(clicked(bool)), this, SLOT(save()));
}
开发者ID:ThFeneuil,项目名称:KholloAutoQt,代码行数:41,代码来源:mergekholleursmanager.cpp

示例14: addParameter

void ParametersToolBox::addParameter(QVBoxLayout * layout,
		const QString & key,
		const QString & value)
{
	if(value.contains(';'))
	{
		QComboBox * widget = new QComboBox(this);
		widget->setObjectName(key);
		QStringList splitted = value.split(':');
		widget->addItems(splitted.last().split(';'));

		if(key.compare(Settings::kFeature2D_1Detector()) == 0)
		{
#if FINDOBJECT_NONFREE == 0
			widget->setItemData(5, 0, Qt::UserRole - 1); // disable SIFT
			widget->setItemData(7, 0, Qt::UserRole - 1); // disable SURF
#endif
#if CV_MAJOR_VERSION < 3
			widget->setItemData(9, 0, Qt::UserRole - 1); // disable AGAST
			widget->setItemData(10, 0, Qt::UserRole - 1); // disable KAZE
			widget->setItemData(11, 0, Qt::UserRole - 1); // disable AKAZE
#else
			widget->setItemData(0, 0, Qt::UserRole - 1); // disable Dense
#ifndef HAVE_OPENCV_XFEATURES2D
			widget->setItemData(6, 0, Qt::UserRole - 1); // disable Star
#endif
#endif
		}
		if(key.compare(Settings::kFeature2D_2Descriptor()) == 0)
		{
#if FINDOBJECT_NONFREE == 0
			widget->setItemData(2, 0, Qt::UserRole - 1); // disable SIFT
			widget->setItemData(3, 0, Qt::UserRole - 1); // disable SURF
#endif
#if CV_MAJOR_VERSION < 3
			widget->setItemData(6, 0, Qt::UserRole - 1); // disable KAZE
			widget->setItemData(7, 0, Qt::UserRole - 1); // disable AKAZE
			widget->setItemData(8, 0, Qt::UserRole - 1); // disable LUCID
			widget->setItemData(9, 0, Qt::UserRole - 1); // disable LATCH
			widget->setItemData(10, 0, Qt::UserRole - 1); // disable DAISY
#else

#ifndef HAVE_OPENCV_XFEATURES2D
			widget->setItemData(0, 0, Qt::UserRole - 1); // disable Brief
			widget->setItemData(5, 0, Qt::UserRole - 1); // disable Freak
			widget->setItemData(8, 0, Qt::UserRole - 1); // disable LUCID
			widget->setItemData(9, 0, Qt::UserRole - 1); // disable LATCH
			widget->setItemData(10, 0, Qt::UserRole - 1); // disable DAISY
#endif
#endif
		}
		if(key.compare(Settings::kNearestNeighbor_1Strategy()) == 0)
		{
#if FINDOBJECT_NONFREE == 0 && CV_MAJOR_VERSION < 3
			// disable FLANN approaches (cannot be used with binary descriptors)
			widget->setItemData(0, 0, Qt::UserRole - 1);
			widget->setItemData(1, 0, Qt::UserRole - 1);
			widget->setItemData(2, 0, Qt::UserRole - 1);
			widget->setItemData(3, 0, Qt::UserRole - 1);
			widget->setItemData(4, 0, Qt::UserRole - 1);
#endif
		}

		widget->setCurrentIndex(splitted.first().toInt());
		connect(widget, SIGNAL(currentIndexChanged(int)), this, SLOT(changeParameter(int)));
		addParameter(layout, key, widget);
	}
开发者ID:clumsycat,项目名称:Car-Detection-Vehicle-Detection,代码行数:67,代码来源:ParametersToolBox.cpp

示例15: setupUI

void ConfigMultiRotorWidget::setupUI(SystemSettings::AirframeTypeOptions frameType)
{
    Q_ASSERT(m_aircraft);
    Q_ASSERT(uiowner);
    Q_ASSERT(quad);

    int i;

    // set aircraftType to Multirotor, disable triyaw channel
    setComboCurrentIndex(m_aircraft->aircraftType, m_aircraft->aircraftType->findText("Multirotor"));
    m_aircraft->triYawChannelBox->setEnabled(false);

    // disable all motor channel boxes
    for (i=1; i <=8; i++) {
        // do it manually so we can turn off any error decorations
        QComboBox *combobox = uiowner->findChild<QComboBox*>("multiMotorChannelBox" + QString::number(i));
        if (combobox) {
            combobox->setEnabled(false);
            combobox->setItemData(0, 0, Qt::DecorationRole);
        }
    }


    switch(frameType) {
    case SystemSettings::AIRFRAMETYPE_TRI:
        setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findData(SystemSettings::AIRFRAMETYPE_TRI));

        //Enable all necessary motor channel boxes...
        enableComboBoxes(uiowner, CHANNELBOXNAME, 3, true);

        m_aircraft->mrRollMixLevel->setValue(100);
        m_aircraft->mrPitchMixLevel->setValue(100);
        setYawMixLevel(50);

        m_aircraft->triYawChannelBox->setEnabled(true);
        break;
    case SystemSettings::AIRFRAMETYPE_QUADX:
        setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findData(SystemSettings::AIRFRAMETYPE_QUADX));

        //Enable all necessary motor channel boxes...
        enableComboBoxes(uiowner, CHANNELBOXNAME, 4, true);

        // init mixer levels
        m_aircraft->mrRollMixLevel->setValue(50);
        m_aircraft->mrPitchMixLevel->setValue(50);
        setYawMixLevel(50);
        break;
    case SystemSettings::AIRFRAMETYPE_QUADP:
        setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findData(SystemSettings::AIRFRAMETYPE_QUADP));

        //Enable all necessary motor channel boxes...
        enableComboBoxes(uiowner, CHANNELBOXNAME, 4, true);

        m_aircraft->mrRollMixLevel->setValue(100);
        m_aircraft->mrPitchMixLevel->setValue(100);
        setYawMixLevel(50);
        break;
    case SystemSettings::AIRFRAMETYPE_HEXA:
        setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findData(SystemSettings::AIRFRAMETYPE_HEXA));

        //Enable all necessary motor channel boxes...
        enableComboBoxes(uiowner, CHANNELBOXNAME, 6, true);

        m_aircraft->mrRollMixLevel->setValue(50);
        m_aircraft->mrPitchMixLevel->setValue(33);
        setYawMixLevel(33);
        break;
    case SystemSettings::AIRFRAMETYPE_HEXAX:
        setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findData(SystemSettings::AIRFRAMETYPE_HEXAX));

        //Enable all necessary motor channel boxes...
        enableComboBoxes(uiowner, CHANNELBOXNAME, 6, true);

        m_aircraft->mrRollMixLevel->setValue(33);
        m_aircraft->mrPitchMixLevel->setValue(50);
        setYawMixLevel(33);
        break;
    case SystemSettings::AIRFRAMETYPE_HEXACOAX:
        setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findData(SystemSettings::AIRFRAMETYPE_HEXACOAX));

        //Enable all necessary motor channel boxes...
        enableComboBoxes(uiowner, CHANNELBOXNAME, 6, true);

        m_aircraft->mrRollMixLevel->setValue(100);
        m_aircraft->mrPitchMixLevel->setValue(50);
        setYawMixLevel(66);
        break;
    case SystemSettings::AIRFRAMETYPE_OCTO:
        setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findData(SystemSettings::AIRFRAMETYPE_OCTO));

        //Enable all necessary motor channel boxes
        enableComboBoxes(uiowner, CHANNELBOXNAME, 8, true);

        m_aircraft->mrRollMixLevel->setValue(33);
        m_aircraft->mrPitchMixLevel->setValue(33);
        setYawMixLevel(25);
        break;
    case SystemSettings::AIRFRAMETYPE_OCTOV:
        setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findData(SystemSettings::AIRFRAMETYPE_OCTOV));
        //Enable all necessary motor channel boxes
//.........这里部分代码省略.........
开发者ID:hotelzululima,项目名称:TeamBlackSheepTauGCS,代码行数:101,代码来源:configmultirotorwidget.cpp


注:本文中的QComboBox::setItemData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。