void KCValidity::loadOdfValidationCondition(QString &valExpression, const KCValueParser *parser) { if (isEmpty()) return; QString value; if (valExpression.indexOf("<=") == 0) { value = valExpression.remove(0, 2); setCondition(KCConditional::InferiorEqual); } else if (valExpression.indexOf(">=") == 0) { value = valExpression.remove(0, 2); setCondition(KCConditional::SuperiorEqual); } else if (valExpression.indexOf("!=") == 0) { //add Differentto attribute value = valExpression.remove(0, 2); setCondition(KCConditional::DifferentTo); } else if (valExpression.indexOf('<') == 0) { value = valExpression.remove(0, 1); setCondition(KCConditional::Inferior); } else if (valExpression.indexOf('>') == 0) { value = valExpression.remove(0, 1); setCondition(KCConditional::Superior); } else if (valExpression.indexOf('=') == 0) { value = valExpression.remove(0, 1); setCondition(KCConditional::Equal); } else kDebug(36003) << " I don't know how to parse it :" << valExpression; if (restriction() == KCValidity::Date) { setMinimumValue(parser->tryParseDate(value)); } else if (restriction() == KCValidity::Date) { setMinimumValue(parser->tryParseTime(value)); } else { bool ok = false; setMinimumValue(KCValue(value.toDouble(&ok))); if (!ok) { setMinimumValue(KCValue(value.toInt(&ok))); if (!ok) kDebug(36003) << " Try to parse this value :" << value; #if 0 if (!ok) setMinimumValue(value); #endif } } }
SGMUndulatorControl::SGMUndulatorControl(QObject *parent) : AMPseudoMotorControl("Undulator", "mm", parent, "SGM Undulator Gap") { encoderControl_ = new AMPVwStatusControl("Undulator Position", "UND1411-01:gap:mm:fbk", "UND1411-01:gap:mm", "UND1411-01:moveStatus", "UND1411-01:stop", this, 0.5); stepControl_ = new AMPVwStatusControl("Undulator Step", "SMTR1411-01:step:sp", "SMTR1411-01:step", "SMTR1411-01:status", "SMTR1411-01:stop", this, 10, 20, new CLSMAXvControlStatusChecker()); stepVelocityControl_ = new AMPVControl("Undulator Velocity", "SMTR1411-01:velo:sp", "SMTR1411-01:velo", QString(), this, 1); stepAccelerationControl_ = new AMPVControl("Undulator Acceleration", "SMTR1411-01:accel:sp", "SMTR1411-01:accel", QString(), this, 1); addChildControl(encoderControl_); addChildControl(stepControl_); AMControlSet* allControls = new AMControlSet(this); allControls->addControl(encoderControl_); allControls->addControl(stepControl_); allControls->addControl(stepVelocityControl_); allControls->addControl(stepAccelerationControl_); connect(allControls, SIGNAL(connected(bool)), this, SLOT(onControlSetConnectionChanged(bool))); setAttemptMoveWhenWithinTolerance(true); setTolerance(encoderControl_->tolerance()); setMinimumValue(encoderControl_->minimumValue()); setMaximumValue(encoderControl_->maximumValue()); }
void HelloWorld::testSlider() { auto slider=ControlSlider::create("xuetiao1.png", "xuetiao2.png", "xuetiao3.png"); slider->setAnchorPoint(Point(0.5, 0.5)); slider->setMinimumValue(0); slider->setMaximumValue(100); //slider->setMaximumAllowedValue(); slider->setPosition(Point(240, 160)); slider->setTag(1); slider->addTargetWithActionForControlEvents(this,cccontrol_selector(HelloWorld::sliderValueChanged),Control::EventType::VALUE_CHANGED); slider->setScale(2); this->addChild(slider); }
BioXASSideM1MirrorBendControl::BioXASSideM1MirrorBendControl(const QString &name, const QString &units, QObject *parent, const QString &description) : BioXASMirrorBendControl(name, units, parent, description) { // Initialize inherited variables. setMinimumValue( calculateBendRadius(12, 12) ); setMaximumValue( calculateBendRadius(0.0001, 0.0001) ); setTolerance(50); // Current settings. updateStates(); }
void KCValidity::loadOdfValidationValue(const QStringList &listVal, const KCValueParser *parser) { bool ok = false; kDebug(36003) << " listVal[0] :" << listVal[0] << " listVal[1] :" << listVal[1]; if (restriction() == KCValidity::Date) { setMinimumValue(parser->tryParseDate(listVal[0])); setMaximumValue(parser->tryParseDate(listVal[1])); } else if (restriction() == KCValidity::Time) { setMinimumValue(parser->tryParseTime(listVal[0])); setMaximumValue(parser->tryParseTime(listVal[1])); } else { setMinimumValue(KCValue(listVal[0].toDouble(&ok))); if (!ok) { setMinimumValue(KCValue(listVal[0].toInt(&ok))); if (!ok) kDebug(36003) << " Try to parse this value :" << listVal[0]; #if 0 if (!ok) setMinimumValue(listVal[0]); #endif } ok = false; setMaximumValue(KCValue(listVal[1].toDouble(&ok))); if (!ok) { setMaximumValue(KCValue(listVal[1].toInt(&ok))); if (!ok) kDebug(36003) << " Try to parse this value :" << listVal[1]; #if 0 if (!ok) setMaximumValue(listVal[1]); #endif } } }
void LabeledDoubleSpinBox::init(double value) { sbValue = new QDoubleSpinBox(); sbValue->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); sbValue->setAlignment(Qt::AlignRight); sbValue->setRange(-50, 50); sbValue->setAccelerated(true); QGridLayout *gl = (QGridLayout *)layout(); gl->addWidget(sbValue, 1, 1); setMinimumValue(-999999999); setMaximumValue(999999999); setDecimals(3); setValue(value); connect(sbValue, SIGNAL(valueChanged(double)), SLOT(onValueChanged(double))); }
BioXASZebraTimeSeconds::BioXASZebraTimeSeconds(const QString &name, QObject *parent) : AMPseudoMotorControl(name, "s", parent) { // Initialize inherited variables. setTolerance(0.001); setContextKnownDescription("ZebraTime"); // Initialize class variables. timeValue_ = 0; timeUnits_ = 0; // Current settings. setMinimumValue(BIOXASZEBRATIMESECONDS_VALUE_MIN); setMaximumValue(BIOXASZEBRATIMESECONDS_VALUE_MAX); updateStates(); }
void AM3DCoordinatedSystemControl::updateMaximumAndMinimumValues() { setMinimumValue(-100); setMaximumValue(100); }
SGMGratingAngleControl::SGMGratingAngleControl(QObject *parent) : AMPseudoMotorControl("Grating Angle Encoder", "Count", parent, "SGM Monochromator Grating Angle") { encoderControl_ = new AMPVwStatusControl("Grating Angle Encoder", "SMTR16114I1002:enc:fbk", "SMTR16114I1002:encTarget", "SMTR16114I1002:status", "SMTR16114I1002:stop", this, 5, 2.0, new CLSMAXvControlStatusChecker(), 1); stepMotorControl_ = new AMPVwStatusControl("Grating Angle Step", "SMTR16114I1002:step:sp", "SMTR16114I1002:step", "SMTR16114I1002:status", "SMTR16114I1002:stop", this, 5, 2.0, new CLSMAXvControlStatusChecker()); stepVelocityControl_ = new AMPVControl("Grating Angle Step Velocity", "SMTR16114I1002:velo:sp", "SMTR16114I1002:velo", QString(), this, 1); stepAccelerationControl_ = new AMPVControl("Grating Angle Step Acceleration", "SMTR16114I1002:accel:sp", "SMTR16114I1002:accel", QString(), this, 0.1); stepsPerEncoderCountControl_ = new AMSinglePVControl("Grating Angle Steps Per Encoder Pulse", "SMTR16114I1002:softRatio", this, 0.1); movementTypeControl_ = new AMSinglePVControl("Grating Angle Move Type", "SMTR16114I1002:encMoveType", this, 0.5); AMControlSet* allControls = new AMControlSet(this); allControls->addControl(encoderControl_); allControls->addControl(stepMotorControl_); allControls->addControl(stepVelocityControl_); allControls->addControl(stepAccelerationControl_); allControls->addControl(stepsPerEncoderCountControl_); allControls->addControl(movementTypeControl_); connect(allControls, SIGNAL(connected(bool)), this, SLOT(onControlSetConnectionChanged(bool))); addChildControl(encoderControl_); addChildControl(stepMotorControl_); setMinimumValue(encoderControl_->minimumValue()); setMaximumValue(encoderControl_->maximumValue()); setTolerance(encoderControl_->tolerance()); setAttemptMoveWhenWithinTolerance(true); updateStates(); }