21 #ifndef _ANGLESPINBOX_HPP_ 22 #define _ANGLESPINBOX_HPP_ 24 #include <QAbstractSpinBox> 67 virtual void stepBy(
int steps);
68 virtual QValidator::State validate(QString& input,
int& pos)
const;
104 void setMinimum(
const double min,
const bool isDegrees=
false) {minRad = min * (isDegrees? M_PI/180.0 : 1.); }
108 double getMinimum(
const bool isDegrees) {
return minRad * (isDegrees ? 180.0/M_PI : 1.0); }
113 void setMaximum(
const double max,
const bool isDegrees=
false) {maxRad = max * (isDegrees? M_PI/180.0 : 1.); }
117 double getMaximum(
const bool isDegrees) {
return maxRad * (isDegrees ? 180.0/M_PI : 1.0); }
122 virtual void clear();
137 virtual StepEnabled stepEnabled()
const;
141 void updateValue(
void);
151 double stringToDouble(QString input, QValidator::State* state,
PrefixType prefix=Unknown)
const;
154 enum AngleSpinboxSection
164 AngleSpinboxSection getCurrentSection()
const;
169 void formatText(
void);
171 static const QString positivePrefix(
PrefixType prefix);
172 static const QString negativePrefix(
PrefixType prefix);
184 #endif // _ANGLESPINBOX_HPP_ void valueChanged()
Emitted when the value changes.
Hours, minutes and seconds, e.g. 12h 4m 6s.
negative values have '-' prefix
void setDisplayFormat(DisplayFormat format)
Set the display format.
double valueRadians()
Get the angle held in the AngleSpinBox.
DisplayFormat
Used to decide how to display the angle.
Hours, minutes and seconds, e.g. 12h 4' 6s".
double getMaximum(const bool isDegrees)
Get the maximum value.
double valueDegrees()
Get the angle held in the AngleSpinBox.
positive values have 'E' prefix, negative values have 'W' prefix.
virtual void clear()
Set the value to default 0 angle.
Degrees, minutes and seconds, e.g. 180d 4m 8s, with negative values, [-360..360d].
void setMinimum(const double min, const bool isDegrees=false)
Set the minimum value.
Degrees, minutes and seconds, e.g. 180° 4' 8", [0..360°].
void setRadians(double radians)
Set the value of the spin box in radians.
Degrees, minutes and seconds, e.g. 180° 4' 8", with negative values, [-360..360°].
A spin box for displaying/entering angular values.
void setDegrees(double degrees)
Set the value of the spin box in decimal degrees.
void setDecimals(int places)
Set the number of decimal places to express float values to (e.g.
positive values have '+' prefix, negative values have '-' prefix.
Degrees, minutes and seconds, e.g. 180d 4m 8s, [0..360d].
positive values have 'N' prefix, negative values have 'S' prefix.
void setMaximum(const double max, const bool isDegrees=false)
Set the maximum value.
PrefixType prefixType()
Get the current display format.
void setPrefixType(PrefixType prefix)
Set the prefix type.
double getMinimum(const bool isDegrees)
Get the minimum value.
DisplayFormat displayFormat()
Get the current display format.
Decimal degrees, e.g. 180.06888.
int decimals()
Get the number of decimal places to express float values to (e.g.
PrefixType
Determines how positive and negative values are indicated.