本文整理汇总了C++中KComboBox::addItems方法的典型用法代码示例。如果您正苦于以下问题:C++ KComboBox::addItems方法的具体用法?C++ KComboBox::addItems怎么用?C++ KComboBox::addItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KComboBox
的用法示例。
在下文中一共展示了KComboBox::addItems方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KComboBox
QWidget *KisInputModeDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &) const
{
KComboBox *combo = new KComboBox(parent);
QStringList sorted = d->action->shortcutIndexes().keys();
qSort(sorted);
combo->addItems(sorted);
return combo;
}
示例2: addRow
/**
* Add a new Row
*/
RowWidgetController* ClassifierListTab::addRow(bool ignoreModified)
{
m_centralTableTW->setRowCount(m_centralTableTW->rowCount()+1);
QString typeName;
QString newItemType;
RowWidgetController* aRow = new RowWidgetController(m_itemType, m_pClassifier, ignoreModified);
switch (m_itemType) {
case ot_Attribute: {
QTableWidgetItem* nameWidget = new QTableWidgetItem("");
nameWidget->setFlags(Qt::ItemIsEditable|Qt::ItemIsEnabled|Qt::ItemIsSelectable);
m_centralTableTW->setItem(m_rowCount,0,nameWidget);
aRow->setName(nameWidget);
//connect(nameWidget,SIGNAL(destroyed(QObject*)),aRow,SLOT(destroyTableItem(QObject*)));
RowWidgetController::linker[nameWidget] = aRow;
TypeCombo* typeCbb = new TypeCombo(this);
m_centralTableTW->setCellWidget(m_rowCount,1,typeCbb);
aRow->setType(typeCbb);
QTableWidgetItem* inititalWidget = new QTableWidgetItem("");
inititalWidget->setFlags(Qt::ItemIsEditable|Qt::ItemIsEnabled|Qt::ItemIsSelectable);
m_centralTableTW->setItem(m_rowCount,2,inititalWidget);
aRow->setInitial(inititalWidget);
//connect(inititalWidget,SIGNAL(destroyed(QObject*)),aRow,SLOT(destroyTableItem(QObject*)));
RowWidgetController::linker[inititalWidget] = aRow;
KComboBox* visibilityCbb = new KComboBox(this);
QStringList availableVisibilities;
availableVisibilities << "Public" << "Private" << "Protected" << "Implementation";
visibilityCbb->addItems(availableVisibilities);
m_centralTableTW->setCellWidget(m_rowCount,3,visibilityCbb);
aRow->setVisibility(visibilityCbb);
QTableWidgetItem* stereotypeWidget = new QTableWidgetItem("");
stereotypeWidget->setFlags(Qt::ItemIsEditable|Qt::ItemIsEnabled|Qt::ItemIsSelectable);
m_centralTableTW->setItem(m_rowCount,4,stereotypeWidget);
aRow->setStereotype(stereotypeWidget);
//connect(stereotypeWidget,SIGNAL(destroyed(QObject*)),aRow,SLOT(destroyTableItem(QObject*)));
RowWidgetController::linker[stereotypeWidget] = aRow;
QCheckBox* staticCb = new QCheckBox(this);
m_centralTableTW->setCellWidget(m_rowCount,5,staticCb);
aRow->setStaticV(staticCb);
PopupButton* docPb = new PopupButton(this);
docPb->setText("Doc");
m_centralTableTW->setCellWidget(m_rowCount,6,docPb);
aRow->setDocumentation(docPb);
}
break;
case ot_Operation: {
typeName = i18n("Operations");
QTableWidgetItem* nameWidget = new QTableWidgetItem("");
nameWidget->setFlags(Qt::ItemIsEditable|Qt::ItemIsEnabled|Qt::ItemIsSelectable);
m_centralTableTW->setItem(m_rowCount,0,nameWidget);
aRow->setName(nameWidget);
//connect(nameWidget,SIGNAL(destroyed(QObject*)),aRow,SLOT(destroyTableItem(QObject*)));
RowWidgetController::linker[nameWidget] = aRow;
ParamWidget* paramWdg = new ParamWidget(this);
m_centralTableTW->setCellWidget(m_rowCount,1,paramWdg);
aRow->setParameters(paramWdg);
TypeCombo* typeCbb = new TypeCombo(this);
typeCbb->setEditable(true);
m_centralTableTW->setCellWidget(m_rowCount,2,typeCbb);
aRow->setType(typeCbb);
KComboBox* visibilityCbb = new KComboBox(this);
QStringList availableVisibilities;
availableVisibilities << "Public" << "Private" << "Protected" << "Implementation"; //TODO anything better?
visibilityCbb->addItems(availableVisibilities);
m_centralTableTW->setCellWidget(m_rowCount,3,visibilityCbb);
aRow->setVisibility(visibilityCbb);
QTableWidgetItem* stereotypeWidget = new QTableWidgetItem("");
stereotypeWidget->setFlags(Qt::ItemIsEditable|Qt::ItemIsEnabled|Qt::ItemIsSelectable);
m_centralTableTW->setItem(m_rowCount,4,stereotypeWidget);
aRow->setStereotype(stereotypeWidget);
//connect(stereotypeWidget,SIGNAL(destroyed(QObject*)),aRow,SLOT(destroyTableItem(QObject*)));
RowWidgetController::linker[stereotypeWidget] = aRow;
QCheckBox* staticCb = new QCheckBox(this);
m_centralTableTW->setCellWidget(m_rowCount,5,staticCb);
aRow->setStaticV(staticCb);
QCheckBox* abstractCb = new QCheckBox(this);
m_centralTableTW->setCellWidget(m_rowCount,6,abstractCb);
aRow->setAbstract(abstractCb);
QCheckBox* constCb = new QCheckBox(this);
m_centralTableTW->setCellWidget(m_rowCount,7,constCb);
aRow->setConstV(constCb);
PopupButton* docPb = new PopupButton(this);
docPb->setText("Doc");
//.........这里部分代码省略.........
示例3: fillListBox
/**
* Fills the list box with the objects associations.
*/
void AssocTab::fillListBox()
{
m_List.clear();
m_pAssocTW->clear();
setupCols();
m_pAssocTW->setRowCount(0);
m_pView->getWidgetAssocs(m_pObject, m_List);
int i = 0;
foreach( AssociationWidget* assocwidget, m_List ) {
if( assocwidget->associationType() != Uml::at_Anchor) {
m_pAssocTW->setRowCount(m_pAssocTW->rowCount()+1);
QTableWidgetItem* nameWidget = new QTableWidgetItem("");
nameWidget->setFlags(Qt::ItemIsEditable|Qt::ItemIsEnabled|Qt::ItemIsSelectable);
nameWidget->setText(assocwidget->getName());
m_pAssocTW->setItem(m_pAssocTW->rowCount()-1,0,nameWidget);
/*QTableWidgetItem* newItem = new QTableWidgetItem(assocwidget->toString());
m_pAssocTW->setItem(m_pAssocTW->rowCount()-1,1,newItem);*/
KComboBox *typeCB = new KComboBox(this);
m_pAssocTW->setCellWidget(m_pAssocTW->rowCount()-1,3,typeCB);
Uml::Association_Type currentType = assocwidget->associationType();
int found=-1;
QStringList assocTypeStrings;
QList<Uml::Association_Type> assocType;
// dynamically load all allowed associations
for ( int i = Uml::at_Generalization; i<= Uml::at_Relationship ; ++i ) {
// we don't need to check for current type
if ( ( Uml::Association_Type )i == currentType )
continue;
if ( AssocRules::allowAssociation( ( Uml::Association_Type )i, assocwidget->getWidget( Uml::A ),
assocwidget->getWidget( Uml::B ))
) {
assocType << (Uml::Association_Type)i;
assocTypeStrings << UMLAssociation::toString((Uml::Association_Type)i);
if ((Uml::Association_Type)i == currentType)
found=true;
}
}
if (found == -1) {
assocType.insert(0, currentType);
assocTypeStrings.insert(0,UMLAssociation::toString(currentType));
}
else {
typeCB->setCurrentIndex(found);
}
typeCB->addItems(assocTypeStrings);
QTableWidgetItem* newItem2 = new QTableWidgetItem(assocwidget->getWidget(Uml::A)->name());
m_pAssocTW->setItem(m_pAssocTW->rowCount()-1,1,newItem2);
QTableWidgetItem* newItem3 = new QTableWidgetItem(assocwidget->getWidget(Uml::B)->name());
m_pAssocTW->setItem(m_pAssocTW->rowCount()-1,2,newItem3);
QPushButton* morePb = new QPushButton(this);
morePb->setText("Doc");
m_pAssocTW->setCellWidget(m_pAssocTW->rowCount()-1,4,morePb);
QPushButton* docPb = new QPushButton(this);
docPb->setText("Doc");
m_pAssocTW->setCellWidget(m_pAssocTW->rowCount()-1,5,docPb);
i++;
}
}
}
示例4: if
/*
InputDialog
*/
InputDialog::InputDialog(const QString &caption, uint options, const QStringList& history, const QString& hint, const QString& alter, KileInfo *ki, QWidget *parent, const char *name)
: KDialog (parent), m_ki(ki)
{
setModal(true);
setButtons(Ok | Cancel);
setDefaultButton(Ok);
showButtonSeparator(true);
setObjectName(name);
QString newcaption = caption;
setCaption(newcaption.remove('&'));
m_labelprefix = ( newcaption == "chapter" ) ? "chap:" : "sec:";
m_usedSelection = false;
QWidget *page = new QWidget(this);
setMainWidget(page);
QGridLayout *gbox = new QGridLayout(page);
QLabel *lb = new QLabel(hint, page);
gbox->addWidget(lb, 0, 0, 1, 3);
m_tag.clear();
QWidget *focus;
if((options & KileAction::KeepHistory) || (options & KileAction::FromLabelList) || (options & KileAction::FromBibItemList)) {
KComboBox *input = new KComboBox(true, page);
input->setObjectName("input_dialog_input");
input->setCompletionMode(KGlobalSettings::CompletionAuto);
input->setMinimumWidth(300);
focus = input;
connect(input, SIGNAL(textChanged(const QString&)), this, SLOT(setTag(const QString&)));
connect(this, SIGNAL(setInput(const QString&)), input, SLOT(setEditText(const QString&)));
if(options & KileAction::ShowBrowseButton) {
gbox->addWidget(input, 1, 0);
}
else {
gbox->addWidget(input, 1, 0, 1, 3);
}
QStringList list;
if(options & KileAction::FromLabelList) {
list = ki->allLabels();
if(list.size() > 0) {
input->addItems(list);
m_tag = list.first();
}
}
else if(options & KileAction::FromBibItemList) {
list = ki->allBibItems();
if(list.size() > 0) {
input->addItems(list);
m_tag = list.first();
}
}
else {
if(history.size() > 0){
input->addItems(history);
m_tag = history.first();
}
}
}