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


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

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


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

示例1: QGroupBox

QWidget *DayView::createConfigWidget( QWidget *owner ) {
    QGroupBox *GroupBox4 = new QGroupBox( owner, "GroupBox4" );
    GroupBox4->setTitle( tr( "Day" ) );
    GroupBox4->setColumnLayout(0, Qt::Vertical );
    GroupBox4->layout()->setSpacing( 0 );
    GroupBox4->layout()->setMargin( 0 );
    QVBoxLayout *GroupBox4Layout = new QVBoxLayout( GroupBox4->layout() );
    GroupBox4Layout->setAlignment( Qt::AlignTop );
    GroupBox4Layout->setSpacing( 6 );
    GroupBox4Layout->setMargin( 11 );

    QCheckBox *chkJumpToCurTime = new QCheckBox( GroupBox4, "chkJumpToCurTime" );
    chkJumpToCurTime->setText( tr( "Jump to current time" ) );
    GroupBox4Layout->addWidget( chkJumpToCurTime );

    QHBoxLayout *Layout5_2 = new QHBoxLayout;
    Layout5_2->setSpacing( 6 );
    Layout5_2->setMargin( 0 );

    QLabel *TextLabel1 = new QLabel( GroupBox4, "TextLabel1" );
    TextLabel1->setText( tr( "Row style:" ) );
    Layout5_2->addWidget( TextLabel1 );

    QComboBox *comboRowStyle = new QComboBox( FALSE, GroupBox4, "comboRowStyle" );
    comboRowStyle->insertItem( tr( "Default" ) );
    comboRowStyle->insertItem( tr( "Medium" ) );
    comboRowStyle->insertItem( tr( "Large" ) );
    Layout5_2->addWidget( comboRowStyle );
    GroupBox4Layout->addLayout( Layout5_2 );

    chkJumpToCurTime->setChecked( jumpToCurTime );
    comboRowStyle->setCurrentItem( rowStyle );

    return GroupBox4;
}
开发者ID:opieproject,项目名称:opie,代码行数:35,代码来源:dayview.cpp

示例2: selectDegree

void Expectations::selectDegree(const QString &title)
{
    selectedDegree_ = UTManager::instance().degreeWithTitle(title);
    int depth;
    selectedDegree_ ? depth = selectedDegree_->depth() : depth = 0;
    while(degreeLayout_->count() > depth + 2)
    {
        QLayoutItem* item = degreeLayout_->takeAt(degreeLayout_->count() - 1);
        degreeLayout_->removeItem(item);
        delete item->widget();
        delete item;
    }
    degreeLayout_->update();

    QList<const Degree*> children = UTManager::instance().degreesWithParent(title);
    if(!children.isEmpty())
    {
        QComboBox* subDegree = new QComboBox;
        subDegree->insertItem(0,"Choix " + children.first()->type());

        for(int i = 0; i < children.size(); i++)
        {
            subDegree->insertItem(i + 1,children.at(i)->title());
        }

        degreeLayout_->addWidget(subDegree);
        QObject::connect(subDegree,SIGNAL(activated(QString)),this,SLOT(selectDegree(QString)));
    }

    degreeLayout_->insertStretch(-1);
}
开发者ID:cmercier,项目名称:UTProfiler,代码行数:31,代码来源:expectations.cpp

示例3: QComboBox

//==========================
QWidget *ComboBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem&, const QModelIndex&) const
{
	QComboBox *editor = new QComboBox(parent);
  editor->insertItem(0,"ЭГ");
  editor->insertItem(1,"връ");
  editor->installEventFilter(const_cast<ComboBoxDelegate*>(this));
  return editor;
}
开发者ID:utech,项目名称:salary,代码行数:9,代码来源:delegates.cpp

示例4:

QComboBox *IDEAS2DScanConfigurationView::createFluorescenceComboBox()
{
	QComboBox *newComboBox = new QComboBox;
	newComboBox->insertItem(0, "None");
	newComboBox->insertItem(1, "Ketek");
	if (IDEASBeamline::ideas()->ge13Element()->isConnected())
		newComboBox->insertItem(2, "13-el Ge");

	return newComboBox;

}
开发者ID:acquaman,项目名称:acquaman,代码行数:11,代码来源:IDEAS2DScanConfigurationView.cpp

示例5: undo

void HistoryElementRemoveWarp::undo()
{
    if(!m_scene)
        return;

    LvlScene* lvlScene;
    if(!(lvlScene = qobject_cast<LvlScene*>(m_scene)))
        return;

    lvlScene->m_data->doors.insert(m_removedDoor.meta.index, m_removedDoor);

    QComboBox* warplist = MainWinConnect::pMainWin->dock_LvlWarpProps->getWarpList();
    warplist->insertItem(m_removedDoor.meta.index, QString("%1: x%2y%3 <=> x%4y%5")
                         .arg(m_removedDoor.meta.array_id).arg(m_removedDoor.ix).arg(m_removedDoor.iy).arg(m_removedDoor.ox).arg(m_removedDoor.oy),
                         m_removedDoor.meta.array_id);
    if(warplist->count() > (int)m_removedDoor.meta.index)
    {
        warplist->setCurrentIndex( m_removedDoor.meta.index );
    }
    else
    {
        warplist->setCurrentIndex( warplist->count()-1 );
    }

    if(m_removedDoor.isSetOut){
        lvlScene->placeDoorExit(m_removedDoor);
    }
    if(m_removedDoor.isSetIn){
        lvlScene->placeDoorEnter(m_removedDoor);
    }


    MainWinConnect::pMainWin->dock_LvlWarpProps->setDoorData(-2);
}
开发者ID:Wohlhabend-Networks,项目名称:PGE-Project,代码行数:34,代码来源:historyelementremovewarp.cpp

示例6: QLabel

/*!
  Builds a volume qm parameter area within the quality measure dialog
  box.  This is simply building a QT combo box for the GWS selection.
*/
void
QualVolume::buildParamArea(qmDlgDataT *qmData)
{
  int i;
  QualVolume *currQM = (QualVolume *)qmData->currQM;

#ifdef GRASPITDBG
  std::cout << "building qualvolume" << std::endl;
#endif

  QBoxLayout *l = new QHBoxLayout(qmData->settingsArea);
  l->setAutoAdd(true);

  // create the GWS type menu
  new QLabel(QString("Limit unit GWS using:"),qmData->settingsArea);
  QComboBox *gwsComboBox = new QComboBox(qmData->settingsArea,"gwsComboBox");  

  // count the number of possible gws types
  for (i=0;GWS::TYPE_LIST[i];i++) {
    gwsComboBox->insertItem(QString(GWS::TYPE_LIST[i]));
    if (currQM && !strcmp(currQM->gws->getType(),GWS::TYPE_LIST[i]))
      gwsComboBox->setCurrentItem(i);
  }

  qmData->paramPtr = gwsComboBox;
}
开发者ID:BerkeleyAutomation,项目名称:google_goggles_project,代码行数:30,代码来源:quality.cpp

示例7: buildSelectWidget

QWidget* ConfigDialog::buildSelectWidget(const ConfigurationValue *value) {
    
    QComboBox *combo = new QComboBox();
    combo->setEditable(false);
    
    ListEntry entry = StringTable::lookup(value->GetValueSpace());
    
    //qDebug() << "value space: " << value->GetValueSpace().c_str();

    ListEntry::iterator iter;    
    for(iter = entry.begin(); iter!=entry.end(); iter++) {
        qDebug() << iter->second << " = " << iter->first.c_str();
        combo->insertItem(iter->second, iter->first.c_str(), QVariant(iter->second));
	}

    //int scalar = value->GetScalar();
    int scalar = StringTable::find(value->GetValueSpace(), value->GetString());
    
    combo->setCurrentIndex(scalar);
    
    QObject::connect(combo, SIGNAL(activated(int)), value, SLOT(SetScalar(int)));
    QObject::connect(combo, SIGNAL(activated(int)), this, SLOT(valueChanged()));
    
    return combo;
}
开发者ID:animesh-garg,项目名称:graspSoft,代码行数:25,代码来源:ConfigDialog.cpp

示例8: text

UnitsEdit *UnitsEditPage::addEdit( const QString &labelKey,
        const char **varList, const char **unitsList, int row, bool showDecimals )
{
    // Find the variable
    EqVar *varPtr = m_dialog->m_bp->m_eqTree->m_varDict->find( varList[0] );
    if ( ! varPtr )
    // This code block should never be executed!
    {
        QString text("");
        translate( text, "UnitsEditDialog:UnknownVar", varList[0] );
        bomb( text );
    }
    // Create the QLabel
    QString text("");
    translate( text, labelKey );
    QLabel *label = new QLabel( text, m_frame,
        QString( "%1:Label" ).arg( labelKey ) );
    Q_CHECK_PTR( label );
    m_grid->addMultiCellWidget( label, row, row, 0, 0, AlignLeft );

    // Create the combo box
    QComboBox *combo = new QComboBox( false, m_frame,
        QString( "%1:ComboBox" ).arg( labelKey ) );
    Q_CHECK_PTR( combo );
    // Insert items into the combo box while searching for the current item
    int n = 0;
    for ( int id = 0;
          unitsList[id];
          id++ )
    {
        combo->insertItem( unitsList[id] );
        if ( appSiUnits()->equivalent(
                unitsList[id], varPtr->m_displayUnits.latin1() ) )
        {
            n = id;
        }
    }
    combo->setCurrentItem( n );
    m_grid->addMultiCellWidget( combo, row, row, 1, 1 );

    // Create the spin box
	QSpinBox *spin = NULL;
	if ( showDecimals )
	{
		spin = new QSpinBox( 0, 6, 1, m_frame,
			QString( "%1:SpinBox" ).arg( labelKey ) );
		Q_CHECK_PTR( spin );
		spin->setValue( varPtr->m_displayDecimals );
		m_grid->addMultiCellWidget( spin, row, row, 2, 2 );
	}
    // All rows share the available space equally
    m_grid->setRowStretch( row, 10 );

    // Create the new UnitsEdit
    UnitsEdit *edit = new UnitsEdit( varList, varPtr, combo, spin );
    checkmem( __FILE__, __LINE__, edit, "UnitsEdit edit", 1 );
    // Add the UnitsEdit to the UnitEditPage's m_editList
    m_editList->append( edit );
    return( edit );
}
开发者ID:cbevins,项目名称:BehavePlus5,代码行数:60,代码来源:unitseditdialog.cpp

示例9: main

int main(int argc, char **argv) {
    QApplication::setDesktopSettingsAware(false);
    QApplication app(argc, argv);
    QComboBox box;
    box.insertItem(0, "foo");
    box.setEditable(true);
    box.show();
    return 0;
}
开发者ID:RS102839,项目名称:qt,代码行数:9,代码来源:main.cpp

示例10: setData

void GlyphEditor::setData(Data* data, DisplayParameters* dp){
    this->data = data;
    GLGlyphView* gv = findChild<GLGlyphView*>("widget");
    gv->setData(data);
    gv->setDisplayParameters(dp);
    QComboBox* col = findChild<QComboBox*>("colorBox");
    QComboBox* disp = findChild<QComboBox*>("displayBox");
    QComboBox* geoBox = findChild<QComboBox*>("geoBox");
    QComboBox* minlBox = findChild<QComboBox*>("minlengthPickBox");
    for (int i = 0; i<data->surfset->afnis.length();i++){
        AFNISurface* afni = data->surfset->afnis.at(i);
        QString displayString = afni->filename;
        col->insertItem(i,displayString);
        disp->insertItem(i,displayString);
        geoBox->insertItem(i,displayString);
        minlBox->insertItem(i,displayString);
    }
}
开发者ID:NeuroanatomyAndConnectivity,项目名称:vidview,代码行数:18,代码来源:glypheditor.cpp

示例11: QComboBox

// Virtual implemetations.
QWidget *qsamplerChannelRoutingComboBox::createEditor (void) const
{
	QComboBox *pComboBox = new QComboBox(QTableItem::table()->viewport());
	QObject::connect(pComboBox, SIGNAL(activated(int)),
		QTableItem::table(), SLOT(doValueChanged()));
	for (QStringList::ConstIterator iter = m_list.begin();
			iter != m_list.end(); iter++) {
		pComboBox->insertItem(QTableItem::pixmap(), *iter);
	}
	pComboBox->setCurrentItem(m_iCurrentItem);
	return pComboBox;
}
开发者ID:svn2github,项目名称:linuxsampler,代码行数:13,代码来源:qsamplerChannel.cpp

示例12: 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

示例13: createEditor

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

    QStringList strings;
    QMapIterator<int, QString> i(boundaryConditionsIdentifier);
    while (i.hasNext()) {
        i.next();
        editor->insertItem(i.key(), i.value());
    }

    return editor;
}
开发者ID:Debilski,项目名称:Wellenprogramm,代码行数:14,代码来源:defects_editor.cpp

示例14: QComboBox

QWidget *DegreeTabDelegate::createEditor(QWidget *parent,
    const QStyleOptionViewItem &/* option */,
    const QModelIndex & index) const
{
    if (index.column() == 0) {
        QComboBox *editor = new QComboBox(parent);
        editor->insertItem(0, "add");
        editor->insertItem(1, "alter");
        editor->insertItem(2, "subtract");
        return editor;
    } else if (index.column() == 1) {
        QSpinBox *editor = new QSpinBox(parent);
        editor->setMinimum(1);
        editor->setMaximum(13);
        return editor;
    } else {
        QSpinBox *editor = new QSpinBox(parent);
        editor->setMinimum(-2);
        editor->setMaximum( 2);
        return editor;
    }
    return 0;
}
开发者ID:Archer90,项目名称:MuseScore,代码行数:23,代码来源:chordedit.cpp

示例15: on_tableViewqianyue_clicked

void ChengjiaoQianyueDialog::on_tableViewqianyue_clicked()
{
    qDebug() << "clicked";
    QSqlRecord record = this->dbcon->qianyue->record(this->tableViewqianyue->currentIndex().row());
    QComboBox * combo;
    QString * value;
    int a;
    combo = this->comboBoxFang;
    value = &(record.value(0).toString());
    if(-1 != (a = combo->findText(*value)))
        combo->setCurrentIndex(a);
    else
        combo->insertItem(0,*value);


    combo = this->comboBoxKe;
    value = &(record.value(1).toString());
    if(-1 != (a = combo->findText(*value)))
        combo->setCurrentIndex(a);
    else
        combo->insertItem(0,*value);
    combo = this->comboBoxRen;
    value = &(record.value(2).toString());
    if(-1 != (a = combo->findText(*value)))
        combo->setCurrentIndex(a);
    else
        combo->insertItem(0,*value);

    combo = this->comboBoxFen;
    value = &(record.value(4).toString());
    if(-1 != (a = combo->findText(*value)))
        combo->setCurrentIndex(a);
    else
        combo->insertItem(0,*value);
    this->spinBoxYongjin->setValue(record.value(3).toInt());
    this->spinBoxBianhao->setValue(record.value(5).toInt());
}
开发者ID:gmsh,项目名称:fangchanzhongjie,代码行数:37,代码来源:chengjiaoqianyuedialog.cpp


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