QgsInterval class
A representation of the interval between two datetime values.
Contents
Public static variables
Public static functions
- static auto fromString(const QString& string) -> QgsInterval
- Converts a string to an interval.
Constructors, destructors, conversion operators
- QgsInterval() defaulted
- Default constructor for QgsInterval.
- QgsInterval(double seconds)
- Constructor for QgsInterval.
- operator QVariant() const
- Allows direct construction of QVariants from intervals.
Public functions
- auto days() const -> double
- Returns the interval duration in days.
- auto hours() const -> double
- Returns the interval duration in hours.
- auto isValid() const -> bool
- Returns true if the interval is valid.
- auto minutes() const -> double
- Returns the interval duration in minutes.
- auto months() const -> double
- Returns the interval duration in months (based on a 30 day month).
- auto seconds() const -> double
- Returns the interval duration in seconds.
- void setDays(double days)
- Sets the interval duration in days.
- void setHours(double hours)
- Sets the interval duration in hours.
- void setMinutes(double minutes)
- Sets the interval duration in minutes.
- void setMonths(double months)
- Sets the interval duration in months.
- void setSeconds(double seconds)
- Sets the interval duration in seconds.
- void setValid(bool valid)
- Sets whether the interval is valid.
- void setWeeks(double weeks)
- Sets the interval duration in weeks.
- void setYears(double years)
- Sets the interval duration in years.
- auto weeks() const -> double
- Returns the interval duration in weeks.
- auto years() const -> double
- Returns the interval duration in years (based on an average year length)
Function documentation
static QgsInterval QgsInterval:: fromString(const QString& string)
Converts a string to an interval.
| Parameters | |
|---|---|
| string | string to parse |
| Returns | interval, or invalid interval if string could not be parsed |
QgsInterval:: QgsInterval() defaulted
Default constructor for QgsInterval.
Creates an invalid interval.
QgsInterval:: QgsInterval(double seconds)
Constructor for QgsInterval.
| Parameters | |
|---|---|
| seconds | duration of interval in seconds |
double QgsInterval:: days() const
Returns the interval duration in days.
double QgsInterval:: hours() const
Returns the interval duration in hours.
bool QgsInterval:: isValid() const
Returns true if the interval is valid.
double QgsInterval:: minutes() const
Returns the interval duration in minutes.
double QgsInterval:: months() const
Returns the interval duration in months (based on a 30 day month).
double QgsInterval:: seconds() const
Returns the interval duration in seconds.
void QgsInterval:: setDays(double days)
Sets the interval duration in days.
| Parameters | |
|---|---|
| days | duration in days |
void QgsInterval:: setHours(double hours)
Sets the interval duration in hours.
| Parameters | |
|---|---|
| hours | duration in hours |
void QgsInterval:: setMinutes(double minutes)
Sets the interval duration in minutes.
| Parameters | |
|---|---|
| minutes | duration in minutes |
void QgsInterval:: setMonths(double months)
Sets the interval duration in months.
| Parameters | |
|---|---|
| months | duration in months (based on a 30 day month) |
void QgsInterval:: setSeconds(double seconds)
Sets the interval duration in seconds.
| Parameters | |
|---|---|
| seconds | duration in seconds |
void QgsInterval:: setValid(bool valid)
Sets whether the interval is valid.
| Parameters | |
|---|---|
| valid | set to true to set the interval as valid. |
void QgsInterval:: setWeeks(double weeks)
Sets the interval duration in weeks.
| Parameters | |
|---|---|
| weeks | duration in weeks |
void QgsInterval:: setYears(double years)
Sets the interval duration in years.
| Parameters | |
|---|---|
| years | duration in years (based on average year length) |
double QgsInterval:: weeks() const
Returns the interval duration in weeks.
double QgsInterval:: years() const
Returns the interval duration in years (based on an average year length)