KDarkLightTransition Class

The KDarkLightTransition type represents a transition from day to night or vice versa. More...

Header: #include <KDarkLightTransition>
CMake: find_package(KNightTime REQUIRED)
target_link_libraries(mytarget PRIVATE KNightTime::KNightTime)

Public Types

enum Relation { Upcoming, InProgress, Passed }
enum Type { Morning, Evening }

Public Functions

KDarkLightTransition()
KDarkLightTransition(KDarkLightTransition::Type type, const QDateTime &startDateTime, const QDateTime &endDateTime)
QDateTime endDateTime() const
qreal progress(const QDateTime &dateTime) const
QDateTime startDateTime() const
KDarkLightTransition::Relation test(const QDateTime &dateTime) const
KDarkLightTransition::Type type() const

Detailed Description

Member Type Documentation

enum KDarkLightTransition::Relation

The Relation enum specifies the relationship between this transition and a point in time.

ConstantValueDescription
KDarkLightTransition::Upcoming0The specified point in time comes before the transition
KDarkLightTransition::InProgress1The specified point in time is between the start and the end of the transition
KDarkLightTransition::Passed2The specified point in time is after the transition

enum KDarkLightTransition::Type

The Type enum specifies the type of a transition.

ConstantValueDescription
KDarkLightTransition::Morning0Transitioning from night time to daylight
KDarkLightTransition::Evening1Transitioning from daylight to night time

Member Function Documentation

KDarkLightTransition::KDarkLightTransition()

Constructs an invalid KDarkLightTransition object.

KDarkLightTransition::KDarkLightTransition(KDarkLightTransition::Type type, const QDateTime &startDateTime, const QDateTime &endDateTime)

Constructs a KDarkLightTransition object with the specified type, startDateTime, and endDateTime.

QDateTime KDarkLightTransition::endDateTime() const

Returns the date and time when the transition ends.

qreal KDarkLightTransition::progress(const QDateTime &dateTime) const

Returns the progress of the transition at the specified dateTime. The progress value is in [0.0, 1.0] range, where 0.0 corresponds to the start of the transition, and 1.0 corresponds to the end of the transition.

QDateTime KDarkLightTransition::startDateTime() const

Returns the date and time when the transition starts.

KDarkLightTransition::Relation KDarkLightTransition::test(const QDateTime &dateTime) const

Checks how the specified dateTime relates to this transition.

KDarkLightTransition::Type KDarkLightTransition::type() const

Returns the type of the transition.