本文整理汇总了C++中QComboBox::setEditable方法的典型用法代码示例。如果您正苦于以下问题:C++ QComboBox::setEditable方法的具体用法?C++ QComboBox::setEditable怎么用?C++ QComboBox::setEditable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QComboBox
的用法示例。
在下文中一共展示了QComboBox::setEditable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setEditorData
void ComboStatutPaymentDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
Q_UNUSED(index);
QComboBox * combo = static_cast<QComboBox*>(editor);
combo->setEditable(true);
combo->addItem(tr(NO_VALIDATED));
combo->addItem(tr(VALIDATED));
combo->addItem(tr(RECORDED));
}
示例2: collectExtraInfo
bool Ruler::collectExtraInfo(QWidget * parent, const QString & family, const QString & prop, const QString & value, bool swappingEnabled, QString & returnProp, QString & returnValue, QWidget * & returnWidget)
{
bool result = PaletteItem::collectExtraInfo(parent, family, prop, value, swappingEnabled, returnProp, returnValue, returnWidget);
if (prop.compare("width", Qt::CaseInsensitive) == 0) {
returnProp = tr("width");
int units = m_modelPart->localProp("width").toString().contains("cm") ? IndexCm : IndexIn;
QLineEdit * e1 = new QLineEdit();
QDoubleValidator * validator = new QDoubleValidator(e1);
validator->setRange(1.0, 20 * ((units == IndexCm) ? 2.54 : 1), 2);
validator->setNotation(QDoubleValidator::StandardNotation);
e1->setValidator(validator);
e1->setEnabled(swappingEnabled);
QString temp = m_modelPart->localProp("width").toString();
temp.chop(2);
e1->setText(temp);
e1->setObjectName("infoViewLineEdit");
e1->setMaximumWidth(80);
m_widthEditor = e1;
m_widthValidator = validator;
QComboBox * comboBox = new QComboBox(parent);
comboBox->setEditable(false);
comboBox->setEnabled(swappingEnabled);
comboBox->addItem("cm");
comboBox->addItem("in");
comboBox->setCurrentIndex(units);
m_unitsEditor = comboBox;
comboBox->setObjectName("infoViewComboBox");
comboBox->setMinimumWidth(60);
QHBoxLayout * hboxLayout = new QHBoxLayout();
hboxLayout->setAlignment(Qt::AlignLeft);
hboxLayout->setContentsMargins(0, 0, 0, 0);
hboxLayout->setSpacing(0);
hboxLayout->setMargin(0);
hboxLayout->addWidget(e1);
hboxLayout->addWidget(comboBox);
QFrame * frame = new QFrame();
frame->setLayout(hboxLayout);
frame->setObjectName("infoViewPartFrame");
connect(e1, SIGNAL(editingFinished()), this, SLOT(widthEntry()));
connect(comboBox, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(unitsEntry(const QString &)));
returnValue = temp + QString::number(units);
returnWidget = frame;
return true;
}
示例3: createEditor
QWidget* ComboBoxDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
QComboBox *comboDelegate = new QComboBox(parent);
comboDelegate->setModel(model);
comboDelegate->setEditable(true);
comboDelegate->setAutoCompletion(true);
comboDelegate->setAutoCompletionCaseSensitivity(Qt::CaseInsensitive);
comboDelegate->completer()->setCompletionMode(QCompleter::PopupCompletion);
return comboDelegate;
}
示例4: QComboBox
QWidget *ComboPayeursDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
Q_UNUSED(option);
Q_UNUSED(index);
QComboBox * combo = new QComboBox(parent);
combo->setEditable(true);
combo->setInsertPolicy(QComboBox::InsertAtTop);
return combo;
}
示例5: sMask
static
QComboBox *controlParamComboBox (
synthv1_controls::Type ctype, QWidget *pParent )
{
QComboBox *pComboBox = new QComboBox(pParent);
synthv1widget_controls::Names map;
int iParamMin = 0;
int iParamMax = iParamMin;
switch(ctype) {
case synthv1_controls::CC:
iParamMin = 0;
iParamMax = 128;
map = synthv1widget_controls::controllerNames();
break;
case synthv1_controls::RPN:
map = synthv1widget_controls::rpnNames();
break;
case synthv1_controls::NRPN:
map = synthv1widget_controls::nrpnNames();
break;
case synthv1_controls::CC14:
iParamMin = 1;
iParamMax = 32;
map = synthv1widget_controls::control14Names();
// Fall thru...
default:
break;
}
const bool bEditable = (iParamMin >= iParamMax);
pComboBox->setEditable(bEditable);
pComboBox->setInsertPolicy(QComboBox::NoInsert);
const QString sMask("%1 - %2");
if (bEditable) {
synthv1widget_controls::Names::ConstIterator iter
= map.constBegin();
const synthv1widget_controls::Names::ConstIterator& iter_end
= map.constEnd();
for ( ; iter != iter_end; ++iter) {
const unsigned short param = iter.key();
pComboBox->addItem(sMask.arg(param).arg(iter.value()), int(param));
}
} else {
for (int iParam = iParamMin; iParam < iParamMax; ++iParam) {
const unsigned short param = iParam;
pComboBox->addItem(sMask.arg(param).arg(map.value(param)), iParam);
}
}
return pComboBox;
}
示例6:
QWidget *EventsWindow::createTagsInput()
{
QComboBox *tagInput = new QComboBox;
tagInput->setEditable(true);
tagInput->setInsertPolicy(QComboBox::NoInsert);
#if QT_VERSION >= 0x040700
tagInput->lineEdit()->setPlaceholderText(tr("Type or select a tag to filter"));
#endif
return tagInput;
}
示例7: defined
//! [10]
QComboBox *Window::createComboBox(const QString &text)
{
QComboBox *comboBox = new QComboBox;
comboBox->setEditable(true);
comboBox->addItem(text);
comboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR)
comboBox->setMinimumContentsLength(3);
#endif
return comboBox;
}
示例8: 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) {
示例9: QComboBox
QWidget *ComboBoxItemDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index) const {
Q_UNUSED(option);
Q_UNUSED(index);
QComboBox *combo = new QComboBox(parent);
combo->setEditable(true);
combo->addItems(data->items);
return combo;
}
示例10: NewWidget
QWidget *OBSPropertiesView::AddList(obs_property_t prop)
{
const char *name = obs_property_name(prop);
QComboBox *combo = new QComboBox();
obs_combo_type type = obs_property_list_type(prop);
obs_combo_format format = obs_property_list_format(prop);
size_t count = obs_property_list_item_count(prop);
int idx = -1;
for (size_t i = 0; i < count; i++)
AddComboItem(combo, prop, format, i);
if (type == OBS_COMBO_TYPE_EDITABLE)
combo->setEditable(true);
if (format == OBS_COMBO_FORMAT_INT) {
int val = (int)obs_data_getint(settings, name);
string valString = to_string(val);
idx = combo->findData(QT_UTF8(valString.c_str()));
} else if (format == OBS_COMBO_FORMAT_FLOAT) {
double val = obs_data_getdouble(settings, name);
string valString = to_string(val);
idx = combo->findData(QT_UTF8(valString.c_str()));
} else if (format == OBS_COMBO_FORMAT_STRING) {
const char *val = obs_data_getstring(settings, name);
if (type == OBS_COMBO_TYPE_EDITABLE)
combo->lineEdit()->setText(val);
else
idx = combo->findData(QT_UTF8(val));
}
if (type == OBS_COMBO_TYPE_EDITABLE)
return NewWidget(prop, combo,
SIGNAL(editTextChanged(const QString &)));
if (idx != -1)
combo->setCurrentIndex(idx);
WidgetInfo *info = new WidgetInfo(this, prop, combo);
connect(combo, SIGNAL(currentIndexChanged(int)), info,
SLOT(ControlChanged()));
children.push_back(std::move(unique_ptr<WidgetInfo>(info)));
/* trigger a settings update if the index was not found */
if (idx == -1)
info->ControlChanged();
return combo;
}
示例11: createEditor
QWidget* ComboBoxItemDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option,
const QModelIndex& index) const
{
Q_UNUSED(option);
Q_UNUSED(index);
QComboBox* editor = new QComboBox(parent);
editor->setModel(m_model);
editor->setEditable(m_editable);
editor->setInsertPolicy(QComboBox::NoInsert);
return editor;
}
示例12: createSelectorWithVHDLStandardLibraries
//-----------------------------------------------------------------------------
// Function: PortsDelegate::createSelectorWithVHDLStandardLibraries()
//-----------------------------------------------------------------------------
QWidget* PortsDelegate::createSelectorWithVHDLStandardLibraries(QWidget* parent) const
{
QComboBox* combo = new QComboBox(parent);
combo->setEditable(true);
combo->setSizeAdjustPolicy(QComboBox::AdjustToContents);
for (unsigned int i = 0;i < VhdlGeneral::VHDL_TYPEDEF_COUNT; ++i)
{
combo->addItem(VhdlGeneral::VHDL_TYPE_DEFINITIONS[i]);
}
return combo;
}
示例13: init
void WebDialogProvider::init(const QString &lbl, WebDialogProvider::Type type)
{
QVBoxLayout *vbox = new QVBoxLayout(this);
label = new QLabel(lbl, this);
vbox->addWidget(label);
vbox->addStretch(1);
switch (type)
{
case WebDialogProvider::LineEdit:
input = new QLineEdit(this);
break;
case WebDialogProvider::SpinBox:
input = new QSpinBox(this);
break;
case WebDialogProvider::DoubleSpinBox:
input = new QDoubleSpinBox(this);
break;
case WebDialogProvider::ComboBox:
case WebDialogProvider::EditableComboBox:
{
QComboBox *combo = new QComboBox(this);
if (type == WebDialogProvider::EditableComboBox)
{
combo->setEditable(true);
}
input = combo;
}
break;
}
vbox->addWidget(input);
vbox->addStretch(1);
#ifndef QT_NO_SHORTCUT
label->setBuddy(input);
#endif
QDialogButtonBox *buttonBox =
new QDialogButtonBox(QDialogButtonBox::Cancel, Qt::Horizontal, this);
buttonBox->setObjectName(QLatin1String("qt_inputdlg_buttonbox"));
QPushButton *okButton =
static_cast<QPushButton *> (buttonBox->addButton(QDialogButtonBox::Ok));
okButton->setDefault(true);
vbox->addWidget(buttonBox);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
}
示例14: 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;
}
示例15: on_AddExpenseButton_clicked
void EntryEditorDialog::on_AddExpenseButton_clicked()
{
//TODO refactor
QHBoxLayout *newLayout = new QHBoxLayout();
QComboBox *entryName = new QComboBox();
newLayout->addWidget(entryName);
entryName->setEditable(true);
entryName->setMinimumWidth(150);
newLayout->addStretch();
QLineEdit *entryAmount = new QLineEdit();
newLayout->addWidget(entryAmount);
entryAmount->setMinimumWidth(100);
entryAmount->setAlignment(Qt::AlignRight);
ui->ExpenseEntryLayout->addLayout(newLayout);
}