Class: QgsProjectVersion

Describes the version of a project.

Used in places where you need to check if the current version of QGIS is greater than the one used to create a project file.

Methods

isNull

Returns True if this is a NULL project version.

majorVersion

Returns the major version number.

minorVersion

Returns the minor version number.

subVersion

Returns the sub version number.

text

Returns a string representation of the version.

class qgis.core.QgsProjectVersion[source]

Bases: object

__init__()

Creates a new NULL version

__init__(major: int, minor: int, sub: int, name: str | None = '')

Constructor for QgsProjectVersion, with the specified major, minor and sub version numbers.

Parameters:
  • major (int)

  • minor (int)

  • sub (int)

  • name (Optional[str] = '')

__init__(string: str | None)

Constructor for QgsProjectVersion, which parses the version number from a string.

Parameters:

string (Optional[str])

__init__(a0: QgsProjectVersion)
Parameters:

a0 (QgsProjectVersion)

isNull(self) bool[source]

Returns True if this is a NULL project version.

Return type:

bool

majorVersion(self) int[source]

Returns the major version number.

Return type:

int

minorVersion(self) int[source]

Returns the minor version number.

Return type:

int

subVersion(self) int[source]

Returns the sub version number.

Return type:

int

text(self) str[source]

Returns a string representation of the version.

Return type:

str