本文整理汇总了C++中QSpinBox::setSingleStep方法的典型用法代码示例。如果您正苦于以下问题:C++ QSpinBox::setSingleStep方法的具体用法?C++ QSpinBox::setSingleStep怎么用?C++ QSpinBox::setSingleStep使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSpinBox
的用法示例。
在下文中一共展示了QSpinBox::setSingleStep方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
// GRID PAGE //
GridPage::GridPage(QWidget* parent, QSettings* appSettings) :
QWidget(parent),
m_pAppSettings(appSettings)
{
QLabel* gridColor = new QLabel("Grid Color", this);
ColorWidget* gridColorSelect = new ColorWidget(this);
QLabel* gridSize = new QLabel("Grid Size", this);
QSpinBox* sizeSpinBox = new QSpinBox;
sizeSpinBox->setRange(0, 200);
sizeSpinBox->setSingleStep(1);
sizeSpinBox->setValue(16);
QLabel* gridCellSize = new QLabel("Grid Cell Size", this);
QSpinBox* cellSizeSpinBox = new QSpinBox;
cellSizeSpinBox->setRange(1, 200);
cellSizeSpinBox->setSingleStep(1);
cellSizeSpinBox->setValue(1);
QGroupBox* gridGroup = new QGroupBox();
QGridLayout* gridLayout = new QGridLayout;
gridLayout->addWidget(gridColor, 0, 0);
gridLayout->addWidget(gridColorSelect, 0, 1);
gridLayout->addWidget(gridSize, 1, 0);
gridLayout->addWidget(sizeSpinBox, 1, 1);
gridLayout->addWidget(gridCellSize, 2, 0);
gridLayout->addWidget(cellSizeSpinBox, 2, 1);
gridGroup->setLayout(gridLayout);
QVBoxLayout* mainLayout = new QVBoxLayout;
mainLayout->addWidget(gridGroup);
mainLayout->addStretch(1);
setLayout(mainLayout);
// Populate the settings
gridColorSelect->setColor(m_pAppSettings->value("GLModelWidget/gridColor",
QColor(0,0,0)).value<QColor>());
sizeSpinBox->setValue(m_pAppSettings->value("GLModelWidget/gridSize", 16).toInt());
cellSizeSpinBox->setValue(m_pAppSettings->value("GLModelWidget/gridCellSize", 1).toInt());
// Backup original values
m_gridColorOrig = gridColorSelect->color();
m_gridSizeOrig = sizeSpinBox->value();
m_gridCellSizeOrig = cellSizeSpinBox->value();
// Hook up the signals
QObject::connect(gridColorSelect, SIGNAL(colorChanged(QColor)),
this, SLOT(setGridColor(QColor)));
QObject::connect(sizeSpinBox, SIGNAL(valueChanged(int)),
this, SLOT(setGridSize(int)));
QObject::connect(cellSizeSpinBox, SIGNAL(valueChanged(int)),
this, SLOT(setgridCellSize(int)));
}
示例2: 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);
});
}
示例3: hist
//-----------------------------------------------------------------------------
void DatPanel::hist()
{
QLabel *l;
QLineEdit *id, *v1, *v2;
QSpinBox *nm;
QPushButton *b;
QDialog *d = new QDialog(this); d->setWindowTitle(tr("UDAV - Make histogram"));
QGridLayout *g = new QGridLayout(d);
l = new QLabel(tr("From"), d); g->addWidget(l,0,0);
l = new QLabel(tr("To"), d); g->addWidget(l,0,1);
v1 = new QLineEdit(d); g->addWidget(v1,1,0);
v2 = new QLineEdit(d); g->addWidget(v2,1,1);
l = new QLabel(tr("Number of points"), d); g->addWidget(l,2,0);
l = new QLabel(tr("Put in variable"), d); g->addWidget(l,2,1);
nm = new QSpinBox(d); nm->setRange(2,8192); g->addWidget(nm,3,0);
id = new QLineEdit(d); nm->setSingleStep(10); g->addWidget(id,3,1);
b = new QPushButton(tr("Cancel"), d); g->addWidget(b,4,0);
connect(b, SIGNAL(clicked()), d, SLOT(reject()));
b = new QPushButton(tr("OK"), d); g->addWidget(b,4,1);
connect(b, SIGNAL(clicked()), d, SLOT(accept())); b->setDefault(true);
// now execute dialog and get values
bool res = d->exec();
if(res && !v1->text().isEmpty() && !v2->text().isEmpty() && !id->text().isEmpty())
{
mglData *vv = dynamic_cast<mglData*>(parser.AddVar(id->text().toLocal8Bit().constData()));
if(vv) vv->Set(mgl_data_hist(var, nm->value(), v1->text().toDouble(), v2->text().toDouble(),0));
updateDataItems();
}
}
示例4: diaLabel
/*!
* Makes a labeled spin box, with the label given by [text] to the left of the
* box and right aligned to it, provided that [layout] is a horizontal layout
* box in which to place them. (In a toolbar, [layout] can be NULL.)
* [minValue], [maxValue], and [step] are the minimum, maximum, and step
* sizes for the spin box. If [nDecimal] is non-zero, it creates and returns
* a QDoubleSpinBox with that number of decimal places. It skips the label
* if [text] is NULL. The focus policy is set to ClickFocus. Keyboard
* tracking is turned off. If a pointer is supplied in the optional argument [labelPtr]
* (which is NULL by default), it is returned with the label pointer.
*/
QAbstractSpinBox *diaLabeledSpin(int nDecimal, float minValue, float maxValue,
float step, const char *text, QWidget *parent,
QBoxLayout *layout, QLabel **labelPtr)
{
QSpinBox *spin;
QDoubleSpinBox *fspin;
if (text) {
QLabel *label = diaLabel(text, parent, layout);
label->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
if (labelPtr)
*labelPtr = label;
}
if (nDecimal) {
fspin = new QDoubleSpinBox(parent);
fspin->setDecimals(nDecimal);
fspin->setRange((double)minValue, (double)maxValue);
fspin->setSingleStep((double)step);
spin = (QSpinBox *)fspin;
} else {
spin = new QSpinBox(parent);
spin->setRange(B3DNINT(minValue), B3DNINT(maxValue));
spin->setSingleStep(B3DNINT(step));
}
if (layout)
layout->addWidget(spin);
spin->setFocusPolicy(Qt::ClickFocus);
spin->setKeyboardTracking(false);
return (QAbstractSpinBox *)spin;
}
示例5: 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;
}
示例6: 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;
}
示例7:
QWidget *SpinBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QSpinBox *w = qobject_cast<QSpinBox*>(QStyledItemDelegate::createEditor(parent, option, index));
w->setRange(min,max);
w->setSingleStep(step);
return w;
}
示例8: initialize_simple_integers
/**
* @brief Initializes the simple integer fields.
*/
void EditEntityDialog::initialize_simple_integers() {
simple_integer_fields <<
SimpleIntegerField("price", tr("Price"), 0, 10, ui.font_field) <<
SimpleIntegerField("jump_length", tr("Jump length"), 16, 8) <<
SimpleIntegerField("speed", tr("Speed"), 1, 8);
for (SimpleIntegerField& field : simple_integer_fields) {
if (entity_before.has_field(field.field_name)) {
QLabel* label = new QLabel(field.label_text, this);
QSpinBox* spinbox = new QSpinBox(this);
spinbox->setMinimum(field.minimum);
spinbox->setMaximum(999999);
spinbox->setValue(entity_before.get_field(field.field_name).toInt());
spinbox->setSingleStep(field.step);
spinbox->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
field.spinbox = spinbox;
if (field.before_widget != nullptr) {
int row = 0;
QFormLayout::ItemRole role;
ui.form_layout->getWidgetPosition(field.before_widget, &row, &role);
if (row != -1) {
ui.form_layout->insertRow(row, label, spinbox);
}
else {
// Widget not found.
ui.form_layout->addRow(label, spinbox);
}
}
else {
ui.form_layout->addRow(label, spinbox);
}
}
}
}
示例9: createEditor
//-----------------------------------------------------------------------------
// Function: AdHocBoundsDelegate::createEditor()
//-----------------------------------------------------------------------------
QWidget* AdHocBoundsDelegate::createEditor(QWidget* parent, QStyleOptionViewItem const& option,
QModelIndex const& index) const
{
// if the column is the one specified for direction items
switch (index.column())
{
case ADHOC_BOUNDS_COL_NAME:
{
QLabel* label = new QLabel(parent);
return label;
}
case ADHOC_BOUNDS_COL_LEFT:
case ADHOC_BOUNDS_COL_RIGHT:
{
QSpinBox* spinBox = new QSpinBox(parent);
spinBox->setSingleStep(1);
// connect(spinBox, SIGNAL(editingFinished()),
// this, SLOT(commitAndCloseEditor()), Qt::UniqueConnection);
return spinBox;
}
default:
{
return QStyledItemDelegate::createEditor(parent, option, index);
}
}
}
示例10: createSpinBoxes
//! [1]
void Window::createSpinBoxes()
{
spinBoxesGroup = new QGroupBox(tr("Spinboxes"));
QLabel *integerLabel = new QLabel(tr("Enter a value between "
"%1 and %2:").arg(-20).arg(20));
QSpinBox *integerSpinBox = new QSpinBox;
integerSpinBox->setRange(-20, 20);
integerSpinBox->setSingleStep(1);
integerSpinBox->setValue(0);
//! [1]
//! [2]
QLabel *zoomLabel = new QLabel(tr("Enter a zoom value between "
"%1 and %2:").arg(0).arg(1000));
//! [3]
QSpinBox *zoomSpinBox = new QSpinBox;
zoomSpinBox->setRange(0, 1000);
zoomSpinBox->setSingleStep(10);
zoomSpinBox->setSuffix("%");
zoomSpinBox->setSpecialValueText(tr("Automatic"));
zoomSpinBox->setValue(100);
//! [2] //! [3]
//! [4]
QLabel *priceLabel = new QLabel(tr("Enter a price between "
"%1 and %2:").arg(0).arg(999));
QSpinBox *priceSpinBox = new QSpinBox;
priceSpinBox->setRange(0, 999);
priceSpinBox->setSingleStep(1);
priceSpinBox->setPrefix("$");
priceSpinBox->setValue(99);
//! [4] //! [5]
QVBoxLayout *spinBoxLayout = new QVBoxLayout;
spinBoxLayout->addWidget(integerLabel);
spinBoxLayout->addWidget(integerSpinBox);
spinBoxLayout->addWidget(zoomLabel);
spinBoxLayout->addWidget(zoomSpinBox);
spinBoxLayout->addWidget(priceLabel);
spinBoxLayout->addWidget(priceSpinBox);
spinBoxesGroup->setLayout(spinBoxLayout);
}
示例11: QSpinBox
QWidget *
pcl::modeler::IntParameter::createEditor(QWidget *parent)
{
QSpinBox *editor = new QSpinBox(parent);
editor->setMinimum(low_);
editor->setMaximum(high_);
editor->setSingleStep(step_);
return editor;
}
示例12:
QSpinBox *ListerDialog::makeSpinBox(int minimum, int maximum, int singleStep)
{
QSpinBox *ret = new QSpinBox;
ret->setMinimum(minimum);
ret->setMaximum(maximum);
ret->setSingleStep(singleStep);
return ret;
}
示例13: QSpinBox
QWidget *
CQPropertyIntegerEditor::
createEdit(QWidget *parent)
{
QSpinBox *spin = new QSpinBox(parent);
spin->setRange(min_, max_);
spin->setSingleStep(step_);
return spin;
}
示例14: newOffsetDial
void UiVariables::newOffsetDial(GLWidget* gl)
{
QSpinBox* offsetDial = new QSpinBox();
offsetDial->setMinimum(-40000000);
offsetDial->setMaximum(40000000);
offsetDial->setValue(0);
offsetDial->setSingleStep(1);
offsets[gl] = offsetDial;
connect(offsetDial, SIGNAL(editingFinished()), this, SIGNAL(internalsUpdated()));
}
示例15: QWidget
QWidget *dSettingWindow::createWidget()
{
QWidget * widget = new QWidget();
QVBoxLayout *layout = new QVBoxLayout;
layout->setMargin(1);
layout->setSpacing(5);
layout->addWidget( new QLabel("Непрозрачноть окна (заначения от 0 до 100).<br>Прозрачные окна имеют проблемы с прорисовкой!") );
QSpinBox *opacitySpinBox = new QSpinBox;
opacitySpinBox->setRange(30, 100);
opacitySpinBox->setSingleStep(1);
opacitySpinBox->setValue(int(window->windowOpacity()*100));
connect(opacitySpinBox, SIGNAL(valueChanged(int)), this, SLOT(opacityValueChanged(int)));
QSlider *opacitySlider = new QSlider(Qt::Horizontal);
opacitySlider->setFocusPolicy(Qt::StrongFocus);
opacitySlider->setTickPosition(QSlider::TicksBothSides);
opacitySlider->setTickInterval(10);
opacitySlider->setSingleStep(1);
opacitySlider->setMaximum ( 100 );
opacitySlider->setMinimum ( 30 );
opacitySlider->setValue(opacitySpinBox->value());
connect(opacitySlider, SIGNAL(valueChanged(int)), opacitySpinBox, SLOT(setValue(int)));
connect(opacitySpinBox, SIGNAL(valueChanged(int)), opacitySlider, SLOT(setValue(int)));
QHBoxLayout *opacityLayout = new QHBoxLayout;
opacityLayout->setSpacing(15);
opacityLayout->addWidget( opacitySpinBox );
opacityLayout->addWidget( opacitySlider );
layout->addItem( opacityLayout );
layout->addWidget( new QLabel("Изменение рамки окна. Есть возможность использовать стандартное окно,<br> но тогда пропадет эффект \"магнетизма\" окон.") );
QHBoxLayout *skinLayout = new QHBoxLayout;
skinLayout->setSpacing(15);
skinPushButton = new QPushButton(tr("Load skin"));
skinPushButton->setDefault(true);
skinPushButton->setIcon(QIcon(tr("pic/open32x32.png")));
connect(skinPushButton, SIGNAL(clicked(bool)), this, SLOT(clickedSkinButton(bool)));
skinLayout->addWidget( skinPushButton );
QCheckBox *standartFrameCheckBox = new QCheckBox(tr("Стандартная рамка окна"));
connect(standartFrameCheckBox, SIGNAL(stateChanged(int)), this, SLOT(stateChanged(int)));
skinLayout->addWidget( standartFrameCheckBox );
skinLayout->addStretch ( 1 );
layout->addItem(skinLayout);
widget->setLayout(layout);
return widget;
};