本文整理汇总了C++中DoubleSpinBox::setValue方法的典型用法代码示例。如果您正苦于以下问题:C++ DoubleSpinBox::setValue方法的具体用法?C++ DoubleSpinBox::setValue怎么用?C++ DoubleSpinBox::setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DoubleSpinBox
的用法示例。
在下文中一共展示了DoubleSpinBox::setValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setColorMap
void ColorMapEditor::setColorMap(const QwtLinearColorMap& map)
{
scaleColorsBox->setChecked(map.mode() == QwtLinearColorMap::ScaledColors);
QwtArray <double> colors = map.colorStops();
int rows = (int)colors.size();
table->setRowCount(rows);
table->blockSignals(true);
QwtDoubleInterval range = QwtDoubleInterval(min_val, max_val);
for (int i = 0; i < rows; i++){
DoubleSpinBox *sb = new DoubleSpinBox();
sb->setLocale(d_locale);
sb->setDecimals(d_precision);
sb->setValue(min_val + colors[i] * range.width());
if (i == 0)
sb->setRange(min_val, min_val);
else if (i == rows -1)
sb->setRange(max_val, max_val);
else
sb->setRange(min_val, max_val);
connect(sb, SIGNAL(valueChanged(double)), this, SLOT(updateColorMap()));
connect(sb, SIGNAL(activated(DoubleSpinBox *)), this, SLOT(spinBoxActivated(DoubleSpinBox *)));
table->setCellWidget(i, 0, sb);
QColor c = QColor(map.rgb(QwtDoubleInterval(0, 1), colors[i]));
QTableWidgetItem *it = new QTableWidgetItem(c.name());
#ifdef Q_CC_MSVC
it->setFlags(it->flags() & (~Qt::ItemIsEditable));
#else
it->setFlags(!Qt::ItemIsEditable);
#endif
it->setBackground(QBrush(c));
it->setForeground(QBrush(c));
table->setItem(i, 1, it);
}
table->blockSignals(false);
color_map = map;
}
示例2: setEditorData
void SettingsDelegate::setEditorData(QWidget* editor,
const QModelIndex& index) const
{
// Get the setting type.
int type = index.model()->data(index, SettingsModel::TypeRole).toInt();
// Set the editor data.
QVariant value = index.model()->data(index, Qt::EditRole);
switch (type)
{
case SettingsValue::INT:
case SettingsValue::UNSIGNED_INT:
case SettingsValue::INT_POSITIVE:
{
// Spin box editors.
static_cast<QSpinBox*>(editor)->setValue(value.toInt());
break;
}
case SettingsValue::UNSIGNED_DOUBLE:
case SettingsValue::DOUBLE:
case SettingsValue::DOUBLE_RANGE:
{
// Double spin box editors.
static_cast<DoubleSpinBox*>(editor)->setValue(
value.toString());
break;
}
case SettingsValue::DOUBLE_RANGE_EXT:
{
DoubleSpinBox* e = static_cast<DoubleSpinBox*>(editor);
QVariant v = index.model()->data(index, SettingsModel::ExtRangeRole);
QList<QVariant> range = v.toList();
double min_ = range[0].toDouble();
QString ext_min_ = range[2].toString();
if (value.toString().toUpper() == ext_min_ ||
value.toDouble() < min_)
e->setValue(e->rangeMin());
else
e->setValue(value.toDouble());
break;
}
case SettingsValue::DATE_TIME:
{
// Date and time editors.
static_cast<QLineEdit*>(editor)->setText(value.toString());
break;
}
case SettingsValue::TIME:
{
// Time editors.
static_cast<QLineEdit*>(editor)->setText(value.toString());
break;
}
case SettingsValue::RANDOM_SEED:
{
// Random seed editors.
if (value.toString().toUpper() == "TIME" || value.toInt() < 1)
static_cast<QSpinBox*>(editor)->setValue(0);
else
static_cast<QSpinBox*>(editor)->setValue(value.toInt());
break;
}
case SettingsValue::INT_RANGE_EXT: // AXIS_RANGE
{
QVariant v = index.model()->data(index, SettingsModel::ExtRangeRole);
QList<QVariant> range = v.toList();
int min_ = range[0].toInt();
QString ext_min_ = range[2].toString();
if (value.toString().toUpper() == ext_min_ || value.toInt() < min_)
static_cast<QSpinBox*>(editor)->setValue(-1);
else
static_cast<QSpinBox*>(editor)->setValue(value.toInt());
break;
}
case SettingsValue::OPTION_LIST:
{
// Options list.
QString str = value.toString();
int i = static_cast<QComboBox*>(editor)->findText(str,
Qt::MatchFixedString);
if (i < 0) i = 0;
static_cast<QComboBox*>(editor)->setCurrentIndex(i);
break;
}
default:
{
// Line editors.
static_cast<QLineEdit*>(editor)->setText(value.toString());
break;
}
}
}
示例3: restoreState
void restoreState(const Archive& archive){
timeScaleRatioSpin.setValue(archive.get("timeScaleRatio", timeScaleRatioSpin.value()));
preInitialDurationSpin.setValue(archive.get("preInitialDuration", preInitialDurationSpin.value()));
postFinalDurationSpin.setValue(archive.get("postFinalDuration", postFinalDurationSpin.value()));
onlyTimeBarRangeCheck.setChecked(archive.get("onlyTimeBarRange", onlyTimeBarRangeCheck.isChecked()));
newBodyItemCheck.setChecked(archive.get("makeNewBodyItem", newBodyItemCheck.isChecked()));
stealthyStepCheck.setChecked(archive.get("stealthyStepMode", stealthyStepCheck.isChecked()));
stealthyHeightRatioThreshSpin.setValue(archive.get("stealthyHeightRatioThresh", stealthyHeightRatioThreshSpin.value()));
flatLiftingHeightSpin.setValue(archive.get("flatLiftingHeight", flatLiftingHeightSpin.value()));
flatLandingHeightSpin.setValue(archive.get("flatLandingHeight", flatLandingHeightSpin.value()));
impactReductionHeightSpin.setValue(archive.get("impactReductionHeight", impactReductionHeightSpin.value()));
impactReductionTimeSpin.setValue(archive.get("impactReductionTime", impactReductionTimeSpin.value()));
autoZmpCheck.setChecked(archive.get("autoZmp", autoZmpCheck.isChecked()));
minZmpTransitionTimeSpin.setValue(archive.get("minZmpTransitionTime", minZmpTransitionTimeSpin.value()));
zmpCenteringTimeThreshSpin.setValue(archive.get("zmpCenteringTimeThresh", zmpCenteringTimeThreshSpin.value()));
zmpTimeMarginBeforeLiftingSpin.setValue(archive.get("zmpTimeMarginBeforeLiftingSpin", zmpTimeMarginBeforeLiftingSpin.value()));
se3Check.setChecked(archive.get("allLinkPositions", se3Check.isChecked()));
lipSyncMixCheck.setChecked(archive.get("lipSyncMix", lipSyncMixCheck.isChecked()));
}
示例4: BodyMotionGenerationSetupDialog
BodyMotionGenerationSetupDialog() : QDialog(MainWindow::instance()){
setWindowTitle(_("Body Motion Generation Setup"));
vbox = new QVBoxLayout();
QHBoxLayout* hbox = newRow(vbox);
hbox->addWidget(new QLabel(_("Time scale")));
timeScaleRatioSpin.setDecimals(2);
timeScaleRatioSpin.setRange(0.01, 9.99);
timeScaleRatioSpin.setSingleStep(0.01);
timeScaleRatioSpin.setValue(1.0);
hbox->addWidget(&timeScaleRatioSpin);
hbox->addSpacing(8);
hbox->addWidget(new QLabel(_("Pre-initial")));
preInitialDurationSpin.setDecimals(1);
preInitialDurationSpin.setRange(0.0, 9.9);
preInitialDurationSpin.setSingleStep(0.1);
preInitialDurationSpin.setValue(1.0);
hbox->addWidget(&preInitialDurationSpin);
hbox->addWidget(new QLabel(_("[s]")));
hbox->addSpacing(8);
hbox->addWidget(new QLabel(_("Post-final")));
postFinalDurationSpin.setDecimals(1);
postFinalDurationSpin.setRange(0.0, 9.9);
postFinalDurationSpin.setSingleStep(0.1);
postFinalDurationSpin.setValue(1.0);
hbox->addWidget(&postFinalDurationSpin);
hbox->addWidget(new QLabel(_("[s]")));
hbox->addStretch();
hbox = newRow(vbox);
onlyTimeBarRangeCheck.setText(_("Time bar's range only"));
onlyTimeBarRangeCheck.setChecked(false);
hbox->addWidget(&onlyTimeBarRangeCheck);
se3Check.setText(_("Put all link positions"));
se3Check.setChecked(false);
hbox->addWidget(&se3Check);
hbox->addStretch();
hbox = newRow(vbox);
newBodyItemCheck.setText(_("Make a new body item"));
newBodyItemCheck.setChecked(true);
hbox->addWidget(&newBodyItemCheck);
hbox->addStretch();
addSeparator(vbox, &stealthyStepCheck);
stealthyStepCheck.setText(_("Stealthy Step Mode"));
stealthyStepCheck.setToolTip(_("This mode makes foot lifting / landing smoother to increase the stability"));
stealthyStepCheck.setChecked(true);
hbox = newRow(vbox);
hbox->addWidget(new QLabel(_("Height ratio thresh")));
stealthyHeightRatioThreshSpin.setAlignment(Qt::AlignCenter);
stealthyHeightRatioThreshSpin.setDecimals(2);
stealthyHeightRatioThreshSpin.setRange(1.00, 9.99);
stealthyHeightRatioThreshSpin.setSingleStep(0.01);
stealthyHeightRatioThreshSpin.setValue(2.0);
hbox->addWidget(&stealthyHeightRatioThreshSpin);
hbox->addStretch();
hbox = newRow(vbox);
hbox->addWidget(new QLabel(_("Flat Lifting Height")));
flatLiftingHeightSpin.setAlignment(Qt::AlignCenter);
flatLiftingHeightSpin.setDecimals(3);
flatLiftingHeightSpin.setRange(0.0, 0.0999);
flatLiftingHeightSpin.setSingleStep(0.001);
flatLiftingHeightSpin.setValue(0.005);
hbox->addWidget(&flatLiftingHeightSpin);
hbox->addWidget(new QLabel(_("[m]")));
hbox->addSpacing(8);
hbox->addWidget(new QLabel(_("Flat Landing Height")));
flatLandingHeightSpin.setAlignment(Qt::AlignCenter);
flatLandingHeightSpin.setDecimals(3);
flatLandingHeightSpin.setRange(0.0, 0.0999);
flatLandingHeightSpin.setSingleStep(0.001);
flatLandingHeightSpin.setValue(0.005);
hbox->addWidget(&flatLandingHeightSpin);
hbox->addWidget(new QLabel(_("[m]")));
hbox->addStretch();
hbox = newRow(vbox);
hbox->addWidget(new QLabel(_("Impact reduction height")));
impactReductionHeightSpin.setAlignment(Qt::AlignCenter);
impactReductionHeightSpin.setDecimals(3);
impactReductionHeightSpin.setRange(0.0, 0.099);
impactReductionHeightSpin.setSingleStep(0.001);
impactReductionHeightSpin.setValue(0.005);
hbox->addWidget(&impactReductionHeightSpin);
hbox->addWidget(new QLabel(_("[m]")));
hbox->addSpacing(8);
hbox->addWidget(new QLabel(_("Impact reduction time")));
impactReductionTimeSpin.setAlignment(Qt::AlignCenter);
impactReductionTimeSpin.setDecimals(3);
impactReductionTimeSpin.setRange(0.001, 0.999);
//.........这里部分代码省略.........
示例5: restoreState
void restoreState(const Archive& archive){
snapDistanceSpin.setValue(archive.get("snapDistance", snapDistanceSpin.value()));
penetrationBlockDepthSpin.setValue(archive.get("penetrationBlockDepth", penetrationBlockDepthSpin.value()));
lazyCollisionDetectionModeCheck.setChecked(archive.get("lazyCollisionDetectionMode", lazyCollisionDetectionModeCheck.isChecked()));
}