本文整理汇总了C++中QSpinBox::setMinimum方法的典型用法代码示例。如果您正苦于以下问题:C++ QSpinBox::setMinimum方法的具体用法?C++ QSpinBox::setMinimum怎么用?C++ QSpinBox::setMinimum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSpinBox
的用法示例。
在下文中一共展示了QSpinBox::setMinimum方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setMe
void diaElemAspectRatio::setMe(void *dialog, void *opaque, uint32_t line)
{
QLabel *text = new QLabel(myQtTitle);
QSpinBox *numBox = new QSpinBox();
QLabel *label = new QLabel(":");
QSpinBox *denBox = new QSpinBox();
QGridLayout *layout = (QGridLayout*) opaque;
QHBoxLayout *hboxLayout = new QHBoxLayout();
myWidget = (void*)numBox;
this->label = (void*)label;
this->denControl = (void*)denBox;
text->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
text->setBuddy(numBox);
numBox->setMinimum(1);
numBox->setMaximum(255);
denBox->setMinimum(1);
denBox->setMaximum(255);
numBox->setValue(*(uint32_t*)param);
denBox->setValue(*(uint32_t*)den);
QSpacerItem *spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
hboxLayout->addWidget(numBox);
hboxLayout->addWidget(label);
hboxLayout->addWidget(denBox);
hboxLayout->addItem(spacer);
layout->addWidget(text,line,0);
layout->addLayout(hboxLayout,line,1);
}
示例2: QSpinBox
QList<QWidget *> Object::getControls()
{
QSpinBox *bonus = new QSpinBox();
bonus->setObjectName("bonus");
bonus->setMaximum(1000);
bonus->setValue(_bonus);
connect(bonus,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
Control *c_bonus = new Control("Bonificación de armadura", bonus);
QSpinBox *time = new QSpinBox();
time->setSuffix(" seg");
time->setObjectName("time");
time->setMinimum(1);
time->setMaximum(1000);
time->setValue(_time);
connect(time,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
Control *c_time = new Control("Tiempo de efecto", time);
QSpinBox *cooldown = new QSpinBox();
cooldown->setSuffix(" seg");
cooldown->setObjectName("cooldown");
cooldown->setMinimum(1);
cooldown->setMaximum(1000);
cooldown->setValue(_cooldown);
connect(cooldown,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
Control *c_cooldown = new Control("Tiempo de reaparición", cooldown);
QList<QWidget*> controls = IObject::getControls();
controls.append(c_bonus);
controls.append(c_time);
controls.append(c_cooldown);
return controls;
}
示例3: settings
TimelinePage::TimelinePage(QWidget* parent) : QWidget(parent)
{
QSettings settings("Pencil","Pencil");
QVBoxLayout* lay = new QVBoxLayout();
QGroupBox* timeLineBox = new QGroupBox(tr("Timeline"));
QCheckBox* drawLabel = new QCheckBox(tr("Draw timeline labels"));
QSpinBox* fontSize = new QSpinBox();
QLabel* frameSizeLabel = new QLabel(tr("Frame size in Pixels"));
QSpinBox* frameSize = new QSpinBox(this);
QLabel* lengthSizeLabel = new QLabel(tr("Timeline size in Frames"));
QLineEdit* lengthSize = new QLineEdit(this);
lengthSize->setInputMask("0009");
QCheckBox* scrubBox = new QCheckBox(tr("Short scrub"));
scrubBox->setChecked(false); // default
if (settings.value("shortScrub").toBool()) scrubBox->setChecked(true);
fontSize->setMinimum(4);
fontSize->setMaximum(20);
frameSize->setMinimum(4);
frameSize->setMaximum(20);
fontSize->setFixedWidth(50);
frameSize->setFixedWidth(50);
lengthSize->setFixedWidth(50);
if (settings.value("drawLabel")=="false") drawLabel->setChecked(false);
else drawLabel->setChecked(true);
fontSize->setValue(settings.value("labelFontSize").toInt());
frameSize->setValue(settings.value("frameSize").toInt());
if (settings.value("labelFontSize").toInt()==0) fontSize->setValue(12);
if (settings.value("frameSize").toInt()==0) frameSize->setValue(6);
lengthSize->setText(settings.value("length").toString());
if (settings.value("length").toInt()==0) lengthSize->setText("240");
connect(fontSize, SIGNAL(valueChanged(int)), parent, SIGNAL(fontSizeChange(int)));
connect(frameSize, SIGNAL(valueChanged(int)), parent, SIGNAL(frameSizeChange(int)));
connect(lengthSize, SIGNAL(textChanged(QString)), parent, SIGNAL(lengthSizeChange(QString)));
connect(drawLabel, SIGNAL(stateChanged(int)), parent, SIGNAL(labelChange(int)));
connect(scrubBox, SIGNAL(stateChanged(int)), parent, SIGNAL(scrubChange(int)));
//lay->addWidget(drawLabel);
//lay->addWidget(fontSizeLabel);
//lay->addWidget(fontSize);
lay->addWidget(frameSizeLabel);
lay->addWidget(frameSize);
lay->addWidget(lengthSizeLabel);
lay->addWidget(lengthSize);
lay->addWidget(scrubBox);
timeLineBox->setLayout(lay);
QVBoxLayout* lay2 = new QVBoxLayout();
lay2->addWidget(timeLineBox);
lay2->addStretch(1);
setLayout(lay2);
}
示例4: settings
ToolsPage::ToolsPage(QWidget* parent) : QWidget(parent)
{
QSettings settings("Pencil","Pencil");
QVBoxLayout* lay = new QVBoxLayout();
QGroupBox* onionSkinBox = new QGroupBox(tr("Onion skin"));
QLabel* onionMaxOpacityLabel = new QLabel(tr("Maximum onion opacity %"));
QSpinBox* onionMaxOpacityBox = new QSpinBox();
QLabel* onionMinOpacityLabel = new QLabel(tr("Minimum onion opacity %"));
QSpinBox* onionMinOpacityBox = new QSpinBox();
QLabel* onionPrevFramesNumLabel = new QLabel(tr("Number of previous onion frames shown"));
QSpinBox* onionPrevFramesNumBox = new QSpinBox();
QLabel* onionNextFramesNumLabel = new QLabel(tr("Number of next onion frames shown"));
QSpinBox* onionNextFramesNumBox = new QSpinBox();
onionMaxOpacityBox->setMinimum(0);
onionMaxOpacityBox->setMaximum(100);
onionMaxOpacityBox->setFixedWidth(50);
onionMinOpacityBox->setMinimum(0);
onionMinOpacityBox->setMaximum(100);
onionMinOpacityBox->setFixedWidth(50);
onionPrevFramesNumBox->setMinimum(1);
onionPrevFramesNumBox->setMaximum(60);
onionPrevFramesNumBox->setFixedWidth(50);
onionNextFramesNumBox->setMinimum(1);
onionNextFramesNumBox->setMaximum(60);
onionNextFramesNumBox->setFixedWidth(50);
onionMaxOpacityBox->setValue(settings.value( SETTING_ONION_MAX_OPACITY ).toInt());
onionMinOpacityBox->setValue(settings.value( SETTING_ONION_MIN_OPACITY ).toInt());
onionPrevFramesNumBox->setValue(settings.value( SETTING_ONION_PREV_FRAMES_NUM).toInt());
onionNextFramesNumBox->setValue(settings.value( SETTING_ONION_NEXT_FRAMES_NUM ).toInt());
connect(onionMaxOpacityBox, SIGNAL(valueChanged(int)), parent, SIGNAL(onionMaxOpacityChange(int)));
connect(onionMinOpacityBox, SIGNAL(valueChanged(int)), parent, SIGNAL(onionMinOpacityChange(int)));
connect(onionPrevFramesNumBox, SIGNAL(valueChanged(int)), parent, SIGNAL(onionPrevFramesNumChange(int)));
connect(onionNextFramesNumBox, SIGNAL(valueChanged(int)), parent, SIGNAL(onionNextFramesNumChange(int)));
lay->addWidget(onionMaxOpacityLabel);
lay->addWidget(onionMaxOpacityBox);
lay->addWidget(onionMinOpacityLabel);
lay->addWidget(onionMinOpacityBox);
lay->addWidget(onionPrevFramesNumLabel);
lay->addWidget(onionPrevFramesNumBox);
lay->addWidget(onionNextFramesNumLabel);
lay->addWidget(onionNextFramesNumBox);
onionSkinBox->setLayout(lay);
QVBoxLayout* lay2 = new QVBoxLayout();
lay2->addWidget(onionSkinBox);
lay2->addStretch(1);
setLayout(lay2);
}
示例5: QDialog
PhotoTimerDialog::PhotoTimerDialog( QWidget* parent, Qt::WFlags f )
: QDialog( parent, f ),
mTimeout( 5 ),
mNumber( 1 ),
mInterval( 1 ),
mIntervalSpin( 0 )
{
setWindowTitle( tr( "Photo Timer" ) );
setModal( true);
QGridLayout* layout = new QGridLayout( this );
// Add labels
layout->addWidget( new QLabel( tr( "Timeout" ) ), 0, 0 );
QSpinBox* timeout = new CameraMinSecSpinBox( this );
timeout->setMinimum( 1 );
timeout->setMaximum( 120 );
timeout->setValue( mTimeout );
layout->addWidget( timeout, 0, 1 );
connect( timeout,
SIGNAL(valueChanged(int)),
this,
SLOT(timeoutChanged(int)) );
layout->addWidget( new QLabel( tr( "Photos" ) ), 1, 0 );
QSpinBox* number = new NoEditSpinBox(this);
number->setMinimum( 1 );
number->setMaximum( 50 );
number->setValue( mNumber );
layout->addWidget( number, 1, 1 );
connect( number,
SIGNAL(valueChanged(int)),
this,
SLOT(numberChanged(int)) );
layout->addWidget( new QLabel( tr( "Interval" ) ), 2, 0 );
mIntervalSpin = new CameraMinSecSpinBox( this );
mIntervalSpin->setMinimum( 1 );
mIntervalSpin->setMaximum( 120 );
mIntervalSpin->setValue( mInterval );
mIntervalSpin->setEnabled( false );
layout->addWidget( mIntervalSpin, 2, 1 );
connect( mIntervalSpin,
SIGNAL(valueChanged(int)),
this,
SLOT(intervalChanged(int)) );
setLayout( layout );
QtopiaApplication::setInputMethodHint(timeout,QtopiaApplication::AlwaysOff);
QtopiaApplication::setInputMethodHint(number,QtopiaApplication::AlwaysOff);
QtopiaApplication::setInputMethodHint(mIntervalSpin,QtopiaApplication::AlwaysOff);
}
示例6: if
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
QWidget *USplata_zaborg_Delegate::createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
QSpinBox *spinbox;
if (index.column() == durationColumn_1) {
spinbox = new QSpinBox(parent);
spinbox->setMaximum ( 999999 );
spinbox->setMinimum ( 1 );
connect(spinbox, SIGNAL(editingFinished()),
this, SLOT(commitAndCloseEditor()));
return spinbox;
}
else if (index.column() == durationColumn_2){
QDoubleSpinBox *double_spinbox = new QDoubleSpinBox(parent);
double_spinbox->setMaximum ( 99999 );
double_spinbox->setMinimum ( 1 );
connect(double_spinbox, SIGNAL(editingFinished()),
this, SLOT(commitAndCloseEditor()));
return double_spinbox;
}
else if ((index.column() == durationColumn_3) || (index.column() == durationColumn_5)) {
spinbox = new QSpinBox(parent);
spinbox->setMaximum ( 12 );
spinbox->setMinimum ( 1 );
connect(spinbox, SIGNAL(editingFinished()),
this, SLOT(commitAndCloseEditor()));
return spinbox;
}
else if ((index.column() == durationColumn_4) || (index.column() == durationColumn_6)) {
spinbox = new QSpinBox(parent);
spinbox->setMaximum ( 2100 );
spinbox->setMinimum ( 2004 );
connect(spinbox, SIGNAL(editingFinished()),
this, SLOT(commitAndCloseEditor()));
return spinbox;
}
else if (index.column() == durationColumn_7) {
QSpinBox *spinbox = new QSpinBox(parent);
spinbox->setMaximum ( 999999 );
spinbox->setMinimum ( 1 );
connect(spinbox, SIGNAL(editingFinished()),
this, SLOT(commitAndCloseEditor()));
return spinbox;
}
else{
return QSqlRelationalDelegate::createEditor(parent, option, index);
}
}
示例7: displayWidget
LifeControlsWidget::LifeControlsWidget(SimOptions *opts, SimController *ctrlr, LifeScrollWidget &scroll) : displayWidget(scroll) {
options = opts;
controller = ctrlr;
delay = 100;
play = false;
QLabel *gridLabel = new QLabel("Grid Size:");
QLabel *delayLabel = new QLabel("Delay:");
genLabel = new QLabel("Generation:\t 1");
refreshGenLabel();
QSpinBox *gridSizeSpin = new QSpinBox();
gridSizeSpin->setMinimum(1);
gridSizeSpin->setMaximum(1000);
gridSizeSpin->setValue(opts->getBlockSize());
QSpinBox *delaySpin = new QSpinBox();
delaySpin->setMinimum(10);
delaySpin->setMaximum(10000);
delaySpin->setValue(delay);
QPushButton *quitBtn = new QPushButton("Quit");
QPushButton *restartBtn = new QPushButton("Restart");
playBtn = new QPushButton("Play");
QPushButton *stepBtn = new QPushButton("Step");
QBoxLayout *box = new QBoxLayout(QBoxLayout::TopToBottom, this);
box->addWidget(gridLabel);
box->addWidget(gridSizeSpin);
box->addWidget(delayLabel);
box->addWidget(delaySpin);
box->addWidget(genLabel);
box->addWidget(quitBtn);
box->addWidget(restartBtn);
box->addWidget(playBtn);
box->addWidget(stepBtn);
box->addStretch(1);
box->addSpacing(12);
setLayout(box);
connect(quitBtn, SIGNAL(clicked()), this, SLOT(onQuit()));
connect(restartBtn, SIGNAL(clicked()), this, SLOT(onRestart()));
connect(playBtn, SIGNAL(clicked()), this, SLOT(onPlay()));
connect(stepBtn, SIGNAL(clicked()), this, SLOT(onStep()));
connect(gridSizeSpin, SIGNAL(valueChanged(int)), this, SLOT(onSizeChange(int)));
connect(delaySpin, SIGNAL(valueChanged(int)), this, SLOT(onDelayChange(int)));
}
示例8: QLabel
QWidget *reDefaultItemEditorFactory::createEditor(QVariant::Type type, QWidget *parent) const
{
switch (type) {
case QVariant::Bool: {
QBooleanComboBox *cb = new QBooleanComboBox(parent);
return cb; }
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; }
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; }
case QVariant::Pixmap:
return new QLabel(parent);
case QVariant::Double: {
QDoubleSpinBox *sb = new QDoubleSpinBox(parent);
sb->setFrame(false);
sb->setMinimum(-DBL_MAX);
sb->setMaximum(DBL_MAX);
return sb; }
case QVariant::String:
default: {
// the default editor is a lineedit
QLineEdit *le = new QLineEdit(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; }
}
return 0;
}
示例9: createPropertyWidget
// Creates the property widgets
//NOTE: Add to the switch statement below if you need to add
// new property types
QWidget* FilterSettingWidget::createPropertyWidget(
const FilterProperty& p,
const QString& curValue,
PropertyAdaptor* adaptor)
{
QWidget *tmp = 0;
switch (p.type) {
case INT_RANGE:
{
QSpinBox *spin = new QSpinBox(this);
tmp = spin;
spin->setMinimum(p.intMin);
spin->setMaximum(p.intMax);
spin->setSingleStep(p.intStep);
spin->setValue(curValue.toInt());
connect(spin, SIGNAL(valueChanged(const QString&)),
adaptor, SLOT(valueChanged(const QString&)));
}
break;
case FLOAT_RANGE:
{
QDoubleSpinBox *spin = new QDoubleSpinBox(this);
tmp = spin;
spin->setMinimum(p.floatMin);
spin->setMaximum(p.floatMax);
spin->setSingleStep(p.floatStep);
spin->setValue(curValue.toDouble());
connect(spin, SIGNAL(valueChanged(const QString&)),
adaptor, SLOT(valueChanged(const QString&)));
}
break;
case STR_SELECTION:
{
QComboBox *combo = new QComboBox(this);
tmp = combo;
QStringList options =
QString::fromStdString(p.options)
.split("\n", QString::SkipEmptyParts);
combo->addItems(options);
int index = 0;
foreach (QString option, options) {
if (option == curValue) {
combo->setCurrentIndex(index);
break;
}
++index;
}
connect(combo, SIGNAL(currentIndexChanged(const QString&)),
adaptor, SLOT(valueChanged(const QString&)));
}
break;
}
return tmp;
}
示例10: QWidget
QWidget* Sis3350UI::createTriggerThresholdControls()
{
// Trigger Threshold Controls
QWidget *box = new QWidget(this);
QSignalMapper *mapper = new QSignalMapper();
QHBoxLayout *l = new QHBoxLayout();
l->setMargin(0);
thresholds = new QList<QSpinBox*>();
QLabel *label = new QLabel(tr("Thr:"),this);
l->addWidget(label);
for(int i=0; i<4; i++)
{
QSpinBox *thr = new QSpinBox(this);
thr->setMinimum(0);
thr->setMaximum(0xFFF);
thr->setAccelerated(true);
thr->setSingleStep(10);
thr->setValue(module->conf.trigger_threshold[i]);
thresholds->append(thr);
connect(thr,SIGNAL(valueChanged(int)),mapper,SLOT(map()));
mapper->setMapping(thr,i);
l->addWidget(thr);
}
connect(mapper,SIGNAL(mapped(int)),this,SLOT(thrChanged(int)));
box->setLayout(l);
return box;
}
示例11: QGroupBox
QWidget * PrefsDialog::createAutosaveForm() {
QGroupBox * autosave = new QGroupBox(tr("Autosave"), this );
QHBoxLayout * zhlayout = new QHBoxLayout();
zhlayout->setSpacing(SPACING);
QCheckBox * box = new QCheckBox(tr("Autosave every:"));
box->setChecked(MainWindow::AutosaveEnabled);
zhlayout->addWidget(box);
zhlayout->addSpacerItem(new QSpacerItem(0,0,QSizePolicy::Expanding));
QSpinBox * spinBox = new QSpinBox;
spinBox->setMinimum(1);
spinBox->setMaximum(60);
spinBox->setValue(MainWindow::AutosaveTimeoutMinutes);
spinBox->setMaximumWidth(80);
zhlayout->addWidget(spinBox);
QLabel * label = new QLabel(tr("minutes"));
zhlayout->addWidget(label);
autosave->setLayout(zhlayout);
connect(box, SIGNAL(clicked(bool)), this, SLOT(toggleAutosave(bool)));
connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(changeAutosavePeriod(int)));
return autosave;
}
示例12: addUniform
void ShaderSelector::addUniform(QGridLayout* settings, const QString& section, const QString& name, int* value, int min, int max, int y, int x) {
QSpinBox* i = new QSpinBox;
if (min < max) {
i->setMinimum(min);
i->setMaximum(max);
}
int def = *value;
bool ok = false;
int v = m_config->getQtOption(name, section).toInt(&ok);
if (ok) {
*value = v;
}
i->setValue(*value);
i->setSingleStep(1);
i->setAccelerated(true);
settings->addWidget(i, y, x);
connect(i, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), [value](int v) {
*value = v;
});
connect(this, &ShaderSelector::saved, [this, section, name, i]() {
m_config->setQtOption(name, i->value(), section);
});
connect(this, &ShaderSelector::reset, [this, section, name, i]() {
bool ok = false;
int v = m_config->getQtOption(name, section).toInt(&ok);
if (ok) {
i->setValue(v);
}
});
connect(this, &ShaderSelector::resetToDefault, [def, section, name, i]() {
i->setValue(def);
});
}
示例13: switch
QWidget *EventDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem &/* option */,
const QModelIndex & index) const
{
const EventModel* pEventModel = static_cast<const EventModel*>(index.model());
switch(index.column()) {
case 0: {
QSpinBox *editor = new QSpinBox(parent);
editor->setMinimum(0);
editor->setMaximum(pEventModel->getFirstLastSample().second);
return editor;
}
case 1: {
QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
editor->setMinimum(0.0);
editor->setMaximum(pEventModel->getFirstLastSample().second / pEventModel->getFiffInfo()->sfreq);
editor->setSingleStep(0.01);
return editor;
}
case 2: {
QComboBox *editor = new QComboBox(parent);
editor->addItems(pEventModel->getEventTypeList());
return editor;
}
}
QWidget *returnWidget = new QWidget();
return returnWidget;
}
示例14: QSpinBox
QWidget *CQSpinBoxDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem & C_UNUSED(option),
const QModelIndex & index) const
{
QSpinBox *editor = new QSpinBox(parent);
editor->setMinimum(1);
unsigned C_INT32 max = 1;
const QSortFilterProxyModel *pProxyDM = dynamic_cast<const QSortFilterProxyModel *>(index.model());
QModelIndex BDMIndex;
const CQBaseDataModel *pBDM;
if (pProxyDM)
{
pBDM = dynamic_cast<const CQBaseDataModel *>(pProxyDM->sourceModel());
BDMIndex = pProxyDM->mapToSource(index);
}
else
{
pBDM = dynamic_cast<const CQBaseDataModel *>(index.model());
BDMIndex = index;
}
if (pBDM)
{
if (pBDM->isDefaultRow(BDMIndex))
max = pBDM->rowCount();
else
max = pBDM->rowCount() - 1;
}
editor->setMaximum(max);
return editor;
}
示例15: LOG
/*!\func IDelegate::createEditor
* создает редактор ячейки
* \param нет
* \return нет
*/
QWidget *IDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem &/* option */,
const QModelIndex & index) const
{
LOG(LOG_DEBUG, QString(__FUNCTION__) + " <" + QString::number(__LINE__) + ">");
switch(index.column()) {
case 0:
{
IdentificatorEdit *editor = new IdentificatorEdit(parent);
//editor->setInputMask("NNNNNNNNNNNNNNN");
return editor;
}
case 1:
{
QSpinBox *editor = new QSpinBox(parent);
editor->setMinimum(1);
editor->setMaximum(100);
return editor;
}
case 2:
{
return 0;
QComboBox *editor = new QComboBox(parent);
editor->addItem("wire");
editor->addItem("reg");
return editor;
}
}
return 0;
}