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


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

本文整理汇总了C++中QComboBox::setFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ QComboBox::setFrame方法的具体用法?C++ QComboBox::setFrame怎么用?C++ QComboBox::setFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QComboBox的用法示例。


在下文中一共展示了QComboBox::setFrame方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createEditor

QWidget* NMGPropertyEditorDelegate::createEditor(QWidget* parent,
                                                 const QStyleOptionViewItem& option,
                                                 const QModelIndex& index) const
{
  Q_UNUSED(option);
  QWidget* editor = 0;
  if(index.column() == 1)
  {
    const QTreeWidgetItem* property = static_cast<QTreeWidgetItem*>(index.internalPointer());
    int valueType = property->data(1, Qt::EditRole).type();
    QString propertyName = property->text(0);
    switch(valueType)
    {
      case QVariant::Bool:
      {
        QComboBox* combo = new QComboBox(parent);
        combo->setFrame(FALSE);
        combo->addItems(QStringList() << QString::fromUtf8("false") << QString::fromUtf8("true"));
        QObject::connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(sync()));
        editor = combo;
        break;
      }
      
      case QVariant::String:
      {
        if(propertyName == "fontFamily")
        {
          QFontDatabase fdb;
          QStringList list = fdb.families(QFontDatabase::Latin);
          QStringList result;
          for(int i = 0; i < list.size(); i++) 
          {
            if(fdb.isScalable(list.at(i))) result += list.at(i);
          }
          QComboBox* combo = new QComboBox(parent);
          combo->setFrame(FALSE);
          combo->addItems(result);
          QObject::connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(sync()));
          editor = combo;
        }
        else if(propertyName == "representation")
        {
          QComboBox* combo = new QComboBox(parent);
          combo->setFrame(FALSE);
          QStringList list;
          list << LINE_TYPE << AREA_TYPE << POINTS_TYPE << BARS_TYPE;
          combo->addItems(list);
          QObject::connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(sync()));
          editor = combo;
        }
        else if(propertyName == "position")
开发者ID:Shwe-123,项目名称:netmeter,代码行数:51,代码来源:nmgpropertyeditordelegate.cpp

示例2: QComboBox

QWidget *ComboboxItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const
{
  QComboBox *editor = new QComboBox(parent);
  editor->setFrame(false);
  editor->setModel(modelFromIndex(index));
  return editor;
}
开发者ID:ursfassler,项目名称:evdraw,代码行数:7,代码来源:ComboboxItemDelegate.cpp

示例3: QComboBox

QWidget *BoolProperty::createEditor(QWidget *parent, const QObject *target, const char *receiver) const
{
	QComboBox *combo = new QComboBox(parent);
	combo->view()->setTextElideMode(Qt::ElideLeft);
	combo->setFrame(0);
	combo->addItems(QStringList() << QString::fromUtf8("false") << QString::fromUtf8("true"));
	QObject::connect(combo, SIGNAL(activated(int)), target, receiver);

	return combo;
}
开发者ID:CharlieCraft,项目名称:axonengine,代码行数:10,代码来源:propertyeditor_items.cpp

示例4: createEditor

QWidget* DelegatDanych::createEditor(QWidget *parent,const QStyleOptionViewItem &option,const QModelIndex &index) const {
    QString field = index.model()->headerData(index.column(), Qt::Horizontal).toString();

    // te 3 nizej polaczyc w jedno : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    if (field == "Wiek" ) {
        QSpinBox* editor = new QSpinBox(parent);
        editor->setFrame(true);
        editor->setMinimum(1);
        editor->setMaximum(100);
        return editor;
    }
    if (field == "Nr domu" ) {
        QSpinBox* editor = new QSpinBox(parent);
        editor->setFrame(true);
        editor->setMinimum(1);
        editor->setMaximum(100);
        return editor;
    }
    if(field == "ID psa" || field == "ID klienta") {
        QSpinBox* editor = new QSpinBox(parent);
        editor->setFrame(true);
        editor->setMinimum(1);
        editor->setMaximum(100);
        //editor->setSingleStep(100);
        return editor;
    }
    if (field == "Numer Telefonu ") {
        QLineEdit* editor = new QLineEdit(parent);
        QRegExp phoneFormat("([1-9]\\d\\d)-(\\d{3})-(\\d{3})");
        QRegExpValidator* phoneValid(new QRegExpValidator(phoneFormat));
        editor->setValidator(phoneValid);
        return editor;
    }
    if(field == "Kategoria") {
        QComboBox* editor = new QComboBox(parent);
        editor->setFrame(true);
        QStringList kategorie;
        kategorie << "Nieokreślony" << "Łagodny" << "Agresywny" << "Do domu" << "Na podwórko";
        editor->addItems(kategorie);
        return editor;
    }
    return QItemDelegate::createEditor(parent, option, index);
}
开发者ID:militia11,项目名称:schroniskoOkienkowe,代码行数:43,代码来源:delegatdanych.cpp

示例5: QComboBox

QWidget *ComboBoxDelegate::createEditor(QWidget *parent,
		const QStyleOptionViewItem& option,
		const QModelIndex& index) const
{
	Position c = index.column();

	if (c >= 2) return QItemDelegate::createEditor(parent, option, index);

	QComboBox* editor = new QComboBox(parent);

	if (c == 0) editor->addItems(sl_modifier_);
	else 			 editor->addItems(sl_keys_);

	editor->setEditable(false);
	editor->setFrame(false);
	editor->setDuplicatesEnabled(false);

	editor->installEventFilter(const_cast<ComboBoxDelegate*>(this));
	editor->showPopup();
	return editor;
}
开发者ID:PierFio,项目名称:ball,代码行数:21,代码来源:pythonSettings.C

示例6: strpart

QWidget *SpinBoxDelegate::createEditor(QWidget *parent,
    const QStyleOptionViewItem &/* option */,
    const QModelIndex &index ) const
{   srand(time(0));
    if(index.column() == 2){
        QComboBox *box = new QComboBox(parent);
        QStringList str;
        QString strpart("8-");
        for(unsigned int i(0); i < 10; i++){
            str << strpart +QString::number(rand() %888 + 111) + "-"+QString::number(rand() %888 + 111)+"-" + QString::number(rand() %88+11)+"-"+ QString::number(rand() %88+11);
        }
        box->addItems(str);
        box->setFrame(false);
        return box;
    }
    QLineEdit *editor = new QLineEdit(parent);
    editor->setFrame(false);
    //editor->setMinimum(0);
    //editor->setMaximum(1000);

    return editor;
}
开发者ID:Xambey,项目名称:learning,代码行数:22,代码来源:spinboxdelegate.cpp

示例7: createEditor

QWidget* SettingsDelegate::createEditor(QWidget* parent,
                                        const QStyleOptionViewItem& /*option*/,
                                        const QModelIndex& index) const
{
    // Get the setting type.
    int type = index.model()->data(index, SettingsModel::TypeRole).toInt();

    // Create the appropriate editor.
    QWidget* editor = 0;
    switch (type)
    {
        case SettingsValue::INT:
        {
            // Spin box editors.
            QSpinBox* spinner = new QSpinBox(parent);
            spinner->setFrame(false);
            spinner->setRange(-INT_MAX, INT_MAX);
            editor = spinner;
            break;
        }
        case SettingsValue::UNSIGNED_INT:
        {
            // Spin box editors.
            QSpinBox* spinner = new QSpinBox(parent);
            spinner->setFrame(false);
            spinner->setRange(0, INT_MAX);
            editor = spinner;
            break;
        }
        case SettingsValue::INT_POSITIVE:
        {
            // Spin box editors.
            QSpinBox* spinner = new QSpinBox(parent);
            spinner->setFrame(false);
            spinner->setRange(1, INT_MAX);
            editor = spinner;
            break;
        }
        case SettingsValue::UNSIGNED_DOUBLE:
        {
            // Double spin box editors.
            DoubleSpinBox* spinner = new DoubleSpinBox(parent);
            spinner->setFrame(false);
            spinner->setRange(0, DBL_MAX);
            editor = spinner;
            break;
        }
        case SettingsValue::DOUBLE:
        {
            // Double spin box editors.
            DoubleSpinBox* spinner = new DoubleSpinBox(parent);
            spinner->setFrame(false);
            spinner->setRange(-DBL_MAX, DBL_MAX);
            editor = spinner;
            break;
        }
        case SettingsValue::DOUBLE_RANGE:
        {
            // Double spin box editors.
            DoubleSpinBox* spinner = new DoubleSpinBox(parent);
            QVariant v = index.model()->data(index, SettingsModel::RangeRole);
            QList<QVariant> range = v.toList();
            double min_ = range[0].toDouble();
            double max_ = range[1].toDouble();
            spinner->setFrame(false);
            spinner->setRange(min_, max_);
            editor = spinner;
            break;
        }
        case SettingsValue::DOUBLE_RANGE_EXT:
        {
            QVariant v = index.model()->data(index, SettingsModel::ExtRangeRole);
            QList<QVariant> range = v.toList();
            double min_ = range[0].toDouble();
            double max_ = range[1].toDouble();
            QString ext_min_ = range[2].toString();
            DoubleSpinBox* spinner = new DoubleSpinBox(parent);
            spinner->setFrame(false);
            spinner->setRange(min_, max_);
            spinner->setMinText(ext_min_);
            editor = spinner;
            break;
        }
        case SettingsValue::DATE_TIME:
        {
            // Date and time editors.
            QLineEdit* line = new QLineEdit(parent);
            line->setFrame(false);
            editor = line;
            break;
        }
        case SettingsValue::TIME:
        {
            // Time editors.
            QLineEdit* line = new QLineEdit(parent);
            line->setFrame(false);
            editor = line;
            break;
        }
        case SettingsValue::RANDOM_SEED:
//.........这里部分代码省略.........
开发者ID:OxfordSKA,项目名称:OSKAR,代码行数:101,代码来源:oskar_SettingsDelegate.cpp

示例8: QComboBox

QWidget* GCF::Components::EnumEditorCreator::createEditor(QWidget* parent)
{
    QComboBox* combo = new QComboBox(parent);
    combo->setFrame(false);
    return combo;
}
开发者ID:banduladh,项目名称:levelfour,代码行数:6,代码来源:ValueEditorCreators.cpp

示例9: createEditor

QWidget* RelationDelegate::createEditor(QWidget *parent,
										const QStyleOptionViewItem &option,
										const QModelIndex &index) const
{
	QWidget* e;

	switch (index.column()) {
		case COLUMN_CATEGORY:
		{
			QComboBox *editor = new QComboBox(parent);
			editor->setFrame(false);

			QSqlQuery query;
			query.exec("SELECT id, name FROM category ORDER BY name ASC");
			while (query.next()) {
				int id = query.value(0).toInt();
				QString name = query.value(1).toString();
				editor->addItem(name, QVariant(id));
			}
			e = editor;
			break;
		}
		case COLUMN_FOOTPRINT:
		{
			QComboBox *editor = new QComboBox(parent);
			editor->setFrame(false);

			QSqlQuery query;
			query.exec("SELECT id, name FROM footprint ORDER BY name ASC");
			while (query.next()) {
				int id = query.value(0).toInt();
				QString name = query.value(1).toString();
				editor->addItem(name, QVariant(id));
			}
			e = editor;
			break;
		}
		case COLUMN_TEMP:
		{
			QComboBox *editor = new QComboBox(parent);
			editor->setFrame(false);

			QSqlQuery query;
			query.exec("SELECT id, name FROM temp ORDER BY name ASC");
			while (query.next()) {
				int id = query.value(0).toInt();
				QString name = query.value(1).toString();
				editor->addItem(name, QVariant(id));
			}
			e = editor;
			break;
		}
		case COLUMN_SUPPL:
		{
			QComboBox *editor = new QComboBox(parent);
			editor->setFrame(false);

			QSqlQuery query;
			query.exec("SELECT id, name FROM suppl ORDER BY name ASC");
			while (query.next()) {
				int id = query.value(0).toInt();
				QString name = query.value(1).toString();
				editor->addItem(name, QVariant(id));
			}
			e = editor;
			break;
		}
		case COLUMN_COUNT:
		case COLUMN_PRICE_VOL:
		{
			QSpinBox *editor = new QSpinBox(parent);
			editor->setFrame(false);
			editor->setRange(-1000000, 1000000);
			e = editor;
			break;
		}
		case COLUMN_PRICE:
		{
			QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
			editor->setFrame(false);
			editor->setRange(-1000000.0, 1000000.0);
			editor->setSingleStep(0.1);
			editor->setDecimals(6);
			e = editor;
			break;
		}
		default:
			e = QStyledItemDelegate::createEditor(parent, option, index);
	}

	return e;
}
开发者ID:MikaelStrom,项目名称:compdb,代码行数:92,代码来源:rel_delegate.cpp


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