25using namespace Qt::StringLiterals;
37 const QString pre =
string.section(
'-', 0, 0 );
38 const QStringList fileVersionParts = pre.section(
'-', 0 ).split(
'.' );
40 mMajor = fileVersionParts.at( 0 ).toInt();
41 if ( fileVersionParts.size() > 1 )
43 mMinor = fileVersionParts.at( 1 ).toInt();
45 if ( fileVersionParts.size() > 2 )
47 mSub = fileVersionParts.at( 2 ).toInt();
49 mName =
string.section(
'-', 1 );
56 return ( ( mMajor == other.mMajor ) &&
57 ( mMinor == other.mMinor ) &&
58 ( mSub == other.mSub ) );
63 return ( ( mMajor != other.mMajor ) ||
64 ( mMinor != other.mMinor ) ||
65 ( mSub != other.mSub ) );
70 return ( *
this == other ) || ( *
this > other );
75 return ( ( mMajor > other.mMajor ) ||
76 ( ( mMajor == other.mMajor ) && ( mMinor > other.mMinor ) ) ||
77 ( ( mMajor == other.mMajor ) && ( mMinor == other.mMinor ) && ( mSub > other.mSub ) ) );
87 return other >= *
this;
93 if ( mName.isEmpty() )
95 return u
"%1.%2.%3"_s.arg( mMajor ).arg( mMinor ).arg( mSub );
99 return u
"%1.%2.%3-%4"_s.arg( mMajor ).arg( mMinor ).arg( mSub ).arg( mName );
105 return mMajor == 0 && mMinor == 0 && mSub == 0;
bool operator>(const QgsProjectVersion &other) const
bool operator!=(const QgsProjectVersion &other) const
QString text() const
Returns a string representation of the version.
bool operator<(const QgsProjectVersion &other) const
bool operator==(const QgsProjectVersion &other) const
bool operator>=(const QgsProjectVersion &other) const
bool operator<=(const QgsProjectVersion &other) const
bool isNull() const
Returns true if this is a NULL project version.
QgsProjectVersion()=default
Creates a new NULL version.
#define QgsDebugMsgLevel(str, level)