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


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

本文整理汇总了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));
}
开发者ID:jeromecc,项目名称:FreeAccounting,代码行数:9,代码来源:delegate.cpp

示例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;
	}
开发者ID:honsey,项目名称:fztaxedit,代码行数:56,代码来源:ruler.cpp

示例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;
}
开发者ID:dbinoj,项目名称:subsurface,代码行数:10,代码来源:modeldelegates.cpp

示例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;
}
开发者ID:jeromecc,项目名称:FreeAccounting,代码行数:10,代码来源:delegate.cpp

示例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;
}
开发者ID:ventosus,项目名称:synthv1,代码行数:55,代码来源:synthv1widget_controls.cpp

示例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;
}
开发者ID:chenbk85,项目名称:bluecherry-client,代码行数:11,代码来源:EventsWindow.cpp

示例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;
}
开发者ID:Kwangsub,项目名称:qt-openwebos,代码行数:12,代码来源:window.cpp

示例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) {
开发者ID:c3c,项目名称:quazaa,代码行数:11,代码来源:settingsdelegate.cpp

示例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;
}
开发者ID:xtuer,项目名称:Qt,代码行数:12,代码来源:ComboBoxItemDelegate.cpp

示例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;
}
开发者ID:FromHeartToSun,项目名称:obs-studio,代码行数:52,代码来源:properties-view.cpp

示例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;
}
开发者ID:Roger-Waters,项目名称:KITScenarist,代码行数:13,代码来源:ComboBoxItemDelegate.cpp

示例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;
}
开发者ID:kammoh,项目名称:kactus2,代码行数:16,代码来源:portsdelegate.cpp

示例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()));
}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:49,代码来源:WebDialogProvider.cpp

示例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;
}
开发者ID:escaped,项目名称:uman,代码行数:15,代码来源:QUDefaultDelegate.cpp

示例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);
}
开发者ID:lborowczak,项目名称:CompanyDataManager,代码行数:16,代码来源:entryeditordialog.cpp


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