本文整理汇总了C++中QComboBox::setAutoFillBackground方法的典型用法代码示例。如果您正苦于以下问题:C++ QComboBox::setAutoFillBackground方法的具体用法?C++ QComboBox::setAutoFillBackground怎么用?C++ QComboBox::setAutoFillBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QComboBox
的用法示例。
在下文中一共展示了QComboBox::setAutoFillBackground方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createEditor
QWidget *DatatypeCombobox::createEditor(QWidget *oParent, const QStyleOptionViewItem &oOption, QModelIndex const &oIndex) const
{
if(hasEditor(oIndex))
{
QComboBox *cb = new QComboBox(oParent);
cb->setAutoFillBackground(true); // Required to show the comboboxes in the view correctly.
for(std::pair<DataType, spt::string::string_t> const &p : mTypeStrings)
cb->addItem(p.second);
return cb;
}
return QStyledItemDelegate::createEditor(oParent, oOption, oIndex);
}
示例2: updateModeColumn
void EFXEditor::updateModeColumn(QTreeWidgetItem* item, EFXFixture* ef)
{
Q_ASSERT(item != NULL);
Q_ASSERT(ef != NULL);
if (m_tree->itemWidget(item, KColumnMode) == NULL)
{
QComboBox* combo = new QComboBox(m_tree);
combo->setAutoFillBackground(true);
combo->addItems(ef->modeList());
const int index = combo->findText(ef->modeToString(ef->mode ()) );
combo->setCurrentIndex(index);
//combo->setCurrentText (ef->modeToString (ef->mode ()));
m_tree->setItemWidget(item, KColumnMode, combo);
combo->setProperty(PROPERTY_FIXTURE, (qulonglong) ef);
connect(combo, SIGNAL(currentIndexChanged(int)),
this, SLOT(slotFixtureModeChanged(int)));
}
示例3: createEditor
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QWidget* ComparisonSelectionItemDelegate::createEditor(QWidget* widgetParent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
QLineEdit* featureValue = NULL;
QDoubleValidator* featureValueValidator = NULL;
QComboBox* operatorCombo = NULL;
ComparisonSelectionTableModel* tableModel = qobject_cast<ComparisonSelectionTableModel*>(parent());
QStringList operators;
operators << (SIMPL::Comparison::Strings::LessThan)
<< (SIMPL::Comparison::Strings::GreaterThan)
<< (SIMPL::Comparison::Strings::Equal);
//QComboBox* phaseCombo = NULL;
QStringList phases;
for(int i = 0; i < m_NumberOfPhases; ++i)
{
phases << QString::number(i + 1);
}
bool ok = false;
qint32 col = index.column();
switch(col)
{
case ComparisonSelectionTableModel::FeatureName:
operatorCombo = new QComboBox(widgetParent);
operatorCombo->addItems(m_FeatureList);
operatorCombo->setAutoFillBackground(true);
if(tableModel)
{
connect(operatorCombo, SIGNAL(currentIndexChanged(int)),
this, SLOT(arrayNameChangedData(int)));
}
return operatorCombo;
case ComparisonSelectionTableModel::FeatureValue:
{
featureValue = new QLineEdit(widgetParent);
featureValue->setFrame(false);
featureValueValidator = new QDoubleValidator(featureValue);
featureValueValidator->setRange(-1.0f * std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), 6);
featureValueValidator->setLocale(QLocale::system());
featureValue->setValidator(featureValueValidator);
QVariant var = index.model()->data(index);
featureValue->setText(QString::number(var.toDouble(&ok), 'g', 6));
if (tableModel)
{
connect(featureValue, SIGNAL(textChanged(const QString&)),
this, SLOT(valueChangedData(const QString&)));
}
return featureValue;
}
case ComparisonSelectionTableModel::FeatureOperator:
operatorCombo = new QComboBox(widgetParent);
operatorCombo->addItems(operators);
operatorCombo->setAutoFillBackground(true);
if (tableModel)
{
connect(operatorCombo, SIGNAL(currentIndexChanged(int)),
this, SLOT(operatorChangedData(int)));
}
return operatorCombo;
// case ComparisonSelectionTableModel::FeaturePhaseValue:
// phaseCombo = new QComboBox(parent);
// phaseCombo->addItems(phases);
// phaseCombo->setAutoFillBackground(true);
// return phaseCombo;
default:
break;
}
return QStyledItemDelegate::createEditor(widgetParent, option, index);
}