本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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 );
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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());
}