本文整理汇总了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")
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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:
//.........这里部分代码省略.........
示例8: QComboBox
QWidget* GCF::Components::EnumEditorCreator::createEditor(QWidget* parent)
{
QComboBox* combo = new QComboBox(parent);
combo->setFrame(false);
return combo;
}
示例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;
}