Skip to content
Snippets Groups Projects
Commit 6ed6950e authored by Ludwig Jaeck's avatar Ludwig Jaeck
Browse files

added a stepsize of 1 in DoubleSpinBox for angle parameters

parent f473ed52
No related branches found
No related tags found
1 merge request!1101GUI: introducing single precission formatting for spinboxes with 'angle' property
Pipeline #77458 failed
......@@ -8,3 +8,11 @@ void DoubleFormatter::setPrecision(int digits){
QString DoubleFormatter::textFromValue(double val) const {
return QString::number(val,'f',m_precision);
}
void DoubleFormatter::setStepSize(double stepSize){
m_stepSize = stepSize;
}
double DoubleFormatter::getStepSize(){
return m_stepSize;
}
......@@ -7,7 +7,10 @@ public:
DoubleFormatter() : m_precision(2){};
QString textFromValue(double val) const;
void setPrecision(int digits);
void setStepSize(double stepSize);
double getStepSize();
private:
int m_precision;
double m_stepSize;
};
#endif // NUMBERFORMATER_H
......@@ -109,6 +109,7 @@ void DoubleSpinBox::updateValue()
}
void DoubleSpinBox::setFormatter(DoubleFormatter formatter){
m_formatter = formatter;
setSingleStep(m_formatter.getStepSize());
}
QString DoubleSpinBox::textFromValue(double val) const {
......
......@@ -89,6 +89,7 @@ void LayerEditorUtils::addMultiPropertyToGrid(QGridLayout* m_gridLayout, int fir
if(valueDescriptor.label == "Angle"){
DoubleFormatter f;
f.setPrecision(1);
f.setStepSize(1.0);
editor->setFormatter(f);
}
QObject::connect(editor, &DoubleSpinBox::baseValueChanged,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment