本文整理汇总了C++中QSpinBox::setFrame方法的典型用法代码示例。如果您正苦于以下问题:C++ QSpinBox::setFrame方法的具体用法?C++ QSpinBox::setFrame怎么用?C++ QSpinBox::setFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSpinBox
的用法示例。
在下文中一共展示了QSpinBox::setFrame方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setValue
void ValueEdit::setValue( const NifValue & v )
{
typ = v.type();
if ( edit )
{
// segfaults with Qt 4.5:
//delete edit;
edit = 0;
resize( this->baseSize() );
}
switch ( typ )
{
case NifValue::tByte:
{
QSpinBox * be = new QSpinBox( this );
be->setFrame(false);
be->setRange( 0, 0xff );
be->setValue( v.toCount() );
edit = be;
}
break;
case NifValue::tWord:
case NifValue::tFlags:
{
QSpinBox * we = new QSpinBox( this );
we->setFrame(false);
we->setRange( 0, 0xffff );
we->setValue( v.toCount() );
edit = we;
}
break;
case NifValue::tShort:
{
QSpinBox * we = new QSpinBox( this );
we->setFrame(false);
we->setRange( SHRT_MIN, SHRT_MAX );
we->setValue( (short)v.toCount() );
edit = we;
}
break;
case NifValue::tInt:
{
QSpinBox * ie = new QSpinBox( this );
ie->setFrame(false);
ie->setRange( INT_MIN, INT_MAX );
ie->setValue( (int)v.toCount() );
edit = ie;
}
break;
case NifValue::tStringIndex:
{
QSpinBox * ie = new QSpinBox( this );
ie->setFrame(false);
ie->setRange( -1, INT_MAX );
ie->setValue( (int)v.toCount() );
edit = ie;
}
break;
case NifValue::tUInt:
{
QSpinBox * ie = new UIntSpinBox( this );
ie->setFrame(false);
ie->setValue( v.toCount() );
edit = ie;
}
break;
case NifValue::tLink:
case NifValue::tUpLink:
{
QLineEdit * le = new QLineEdit( this );
int tmp = v.toLink();
if ( tmp > 0 ) {
le->setText( QString::number(tmp) );
}
edit = le;
}
break;
case NifValue::tFloat:
{
FloatEdit * fe = new FloatEdit( this );
/*
fe->setFrame(false);
fe->setRange( -1e10, +1e10 );
fe->setDecimals( 4 );
*/
fe->setValue( v.toFloat() );
edit = fe;
}
break;
case NifValue::tText:
case NifValue::tSizedString:
{
TextEdit * te = new TextEdit( v.toString(), this );
te->resize( size() );
connect( te, SIGNAL( sigResized(QResizeEvent *) ), this, SLOT( childResized(QResizeEvent *) ) );
edit = te;
}
//.........这里部分代码省略.........
示例2: QLabel
QWidget *QDefaultItemEditorFactory::createEditor(QVariant::Type type, QWidget *parent) const
{
switch (type) {
#ifndef QT_NO_COMBOBOX
case QVariant::Bool: {
QBooleanComboBox *cb = new QBooleanComboBox(parent);
cb->setFrame(false);
return cb;
}
#endif
#ifndef QT_NO_SPINBOX
case QVariant::UInt: {
QSpinBox *sb = new QSpinBox(parent);
sb->setFrame(false);
sb->setMaximum(INT_MAX);
return sb;
}
case QVariant::Int: {
QSpinBox *sb = new QSpinBox(parent);
sb->setFrame(false);
sb->setMinimum(INT_MIN);
sb->setMaximum(INT_MAX);
return sb;
}
#endif
#ifndef QT_NO_DATETIMEEDIT
case QVariant::Date: {
QDateTimeEdit *ed = new QDateEdit(parent);
ed->setFrame(false);
return ed;
}
case QVariant::Time: {
QDateTimeEdit *ed = new QTimeEdit(parent);
ed->setFrame(false);
return ed;
}
case QVariant::DateTime: {
QDateTimeEdit *ed = new QDateTimeEdit(parent);
ed->setFrame(false);
return ed;
}
#endif
case QVariant::Pixmap:
return new QLabel(parent);
#ifndef QT_NO_SPINBOX
case QVariant::Double: {
QDoubleSpinBox *sb = new QDoubleSpinBox(parent);
sb->setFrame(false);
sb->setMinimum(-DBL_MAX);
sb->setMaximum(DBL_MAX);
return sb;
}
#endif
#ifndef QT_NO_LINEEDIT
case QVariant::String:
default: {
// the default editor is a lineedit
QExpandingLineEdit *le = new QExpandingLineEdit(parent);
le->setFrame(le->style()->styleHint(QStyle::SH_ItemView_DrawDelegateFrame, 0, le));
if (!le->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, le))
le->setWidgetOwnsGeometry(true);
return le;
}
#else
default:
break;
#endif
}
return 0;
}
示例3: 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:
//.........这里部分代码省略.........
示例4: 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;
}
示例5: createEditor
QWidget* SceneTableUi::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
ObsAction* action = 0;
if (ObsActions)
{
action = (*ObsActions)[index.row()+1];
}
int delay = 0;
QString currentSceneOrTransition;
switch (index.column())
{
case QTV_DELAY1:
delay = action ? action->GetDelay1():0;
break;
case QTV_DELAY2:
delay = action ? action->GetDelay2():0;
break;
case QTV_SCENE1:
currentSceneOrTransition = action ? action->GetScene1Name():"";
break;
case QTV_SCENE2:
currentSceneOrTransition = action ? action->GetScene2Name():"";
break;
case QTV_TRANSITION:
currentSceneOrTransition = action ? action->GetTransitionName():"";
break;
}
switch (index.column())
{
case QTV_ACTION:
{
return new QLabel(action ? action->actionName:"");
}
break;
case QTV_DELAY1:
case QTV_DELAY2:
{
QSpinBox *editor = new QSpinBox(parent);
editor->setFrame(false);
editor->setValue(delay);
editor->setMinimum(0);
editor->setMaximum(100);
return editor;
}
break;
case QTV_SCENE1:
case QTV_SCENE2:
case QTV_TRANSITION:
{
QComboBox* comboBox = new QComboBox(parent);
comboBox->addItems(index.column() == QTV_TRANSITION?Transitions:Scenes);
int index = comboBox->findText(currentSceneOrTransition);
if ( index != -1 )
{
comboBox->setCurrentIndex(index);
}
return comboBox;
}
break;
}
}
示例6: cancel
//.........这里部分代码省略.........
item = new QTableWidgetItem(tr(qPrintable(fid)));
item->setData(Qt::UserRole, fid);
item->setFlags(Qt::ItemIsEnabled);
m_table->setItem(r, 0, item);
item = new QTableWidgetItem;
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
item->setCheckState(fmt.weight == QFont::Bold ? Qt::Checked : Qt::Unchecked);
item->setToolTip(m_table->horizontalHeaderItem(1)->toolTip());
m_table->setItem(r, 1, item);
item = new QTableWidgetItem;
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
item->setCheckState(fmt.italic ? Qt::Checked : Qt::Unchecked);
item->setToolTip(m_table->horizontalHeaderItem(2)->toolTip());
m_table->setItem(r, 2, item);
item = new QTableWidgetItem;
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
item->setCheckState(fmt.underline ? Qt::Checked : Qt::Unchecked);
item->setToolTip(m_table->horizontalHeaderItem(3)->toolTip());
m_table->setItem(r, 3, item);
item = new QTableWidgetItem;
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
item->setCheckState(fmt.overline ? Qt::Checked : Qt::Unchecked);
item->setToolTip(m_table->horizontalHeaderItem(4)->toolTip());
m_table->setItem(r, 4, item);
item = new QTableWidgetItem;
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
item->setCheckState(fmt.strikeout ? Qt::Checked : Qt::Unchecked);
item->setToolTip(m_table->horizontalHeaderItem(5)->toolTip());
m_table->setItem(r, 5, item);
item = new QTableWidgetItem;
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
item->setCheckState(fmt.waveUnderline ? Qt::Checked : Qt::Unchecked);
item->setToolTip(m_table->horizontalHeaderItem(6)->toolTip());
m_table->setItem(r, 6, item);
m_table->setCellWidget(r, 7, new QSimpleColorPicker(fmt.foreground));
m_table->cellWidget(r, 7)->setToolTip(m_table->horizontalHeaderItem(7)->toolTip());
//m_table->cellWidget(i, 7)->setMaximumSize(22, 22);
m_table->setCellWidget(r, 8, new QSimpleColorPicker(fmt.background));
m_table->cellWidget(r, 8)->setToolTip(m_table->horizontalHeaderItem(8)->toolTip());
//m_table->cellWidget(i, 8)->setMaximumSize(22, 22);
m_table->setCellWidget(r, 9, new QSimpleColorPicker(fmt.linescolor));
m_table->cellWidget(r, 9)->setToolTip(m_table->horizontalHeaderItem(9)->toolTip());
//m_table->cellWidget(i, 9)->setMaximumSize(22, 22);
//item = new QTableWidgetItem;
QFontComboBox *fcmb=new QFontComboBox();
fcmb->insertItem(0, "<default>");
int ind=fcmb->findText(fmt.fontFamily);
if(ind>-1) fcmb->setCurrentIndex(ind);
else fcmb->setCurrentIndex(0);
//int ind=fcmb->findText(fmt.fontFamily);
//if(ind>-1) fcmb->setCurrentIndex(ind);
//else fcmb->setCurrentIndex(0);
//QComboBox *fcmb=new QComboBox();
//fcmb->addItems(fonts);
//int ind=fcmb->findText(fmt.fontFamily);
//if(ind>-1) fcmb->setCurrentIndex(ind);
//else fcmb->setCurrentIndex(0);
m_table->setCellWidget(r, 10, fcmb);
fcmb->setToolTip(m_table->horizontalHeaderItem(10)->toolTip());
QDoubleSpinBox* sb = new QDoubleSpinBox();
sb->setMaximum(100000);
sb->setMinimum(1);
sb->setDecimals(0);
sb->setSuffix("%");
sb->setAlignment(Qt::AlignRight);
sb->setFrame(false);
double v = fmt.pointSize?100.0*fmt.pointSize/basePointSize:100;
sb->setValue(v);
sb->setToolTip(m_table->horizontalHeaderItem(11)->toolTip());
m_table->setCellWidget(r, 11, sb);
QSpinBox *psb = new QSpinBox();
psb->setMaximum(100);
psb->setMinimum(-1);
psb->setAlignment(Qt::AlignRight);
psb->setFrame(false);
psb->setValue(fmt.priority);
psb->setToolTip(m_table->horizontalHeaderItem(12)->toolTip());
m_table->setCellWidget(r, 12, psb);
r++;
}
}
}
m_table->resizeColumnsToContents();
qDebug () << T.elapsed();
}