Class: QgsLayoutPoint¶
- class qgis.core.QgsLayoutPoint(x: float, y: float, units: QgsUnitTypes.LayoutUnit = QgsUnitTypes.LayoutMillimeters)¶
Bases:
sip.wrapper
Constructor for QgsLayoutPoint.
QgsLayoutPoint(point: Union[QPointF, QPoint], units: QgsUnitTypes.LayoutUnit = QgsUnitTypes.LayoutMillimeters) Constructor for QgsLayoutPoint.
QgsLayoutPoint(units: QgsUnitTypes.LayoutUnit = QgsUnitTypes.LayoutMillimeters) Constructor for an empty point, where both x and y are set to 0.
- Parameters
units – units for measurement
QgsLayoutPoint(
QgsLayoutPoint
)This class provides a method of storing points, consisting of an x and y coordinate, for use in QGIS layouts. Measurement units are stored alongside the position.
See also
Note
This class does not inherit from QPointF since QPointF includes methods which should not apply to positions with units. For instance, the + and - operators would mislead users of this class to believe that addition of two
QgsLayoutPoints
with different unit types would automatically convert units. Instead, all unit conversion must be handled by aQgsLayoutMeasurementConverter
so that conversion between paper and screen units can be correctly performed.Methods
Decodes a point from a
string
.Encodes the layout point to a string
Tests whether the position is null, ie both its x and y coordinates are zero.
Sets new x and y coordinates for the point.
Sets the
units
for the point.Sets the x coordinate of point.
Sets y coordinate of point.
Converts the layout point to a QPointF.
Returns the units for the point.
Returns x coordinate of point.
Returns y coordinate of point.
- decodePoint(string: str) → QgsLayoutPoint¶
Decodes a point from a
string
.See also
- Parameters
string (str) –
- Return type
- encodePoint(self) → str¶
Encodes the layout point to a string
See also
- Return type
str
- isNull(self) → bool¶
Tests whether the position is null, ie both its x and y coordinates are zero.
- Return type
bool
- Returns
True
if point is null
- setPoint(self, x: float, y: float)¶
Sets new x and y coordinates for the point.
See also
See also
See also
- Parameters
x (float) –
y (float) –
- setUnits(self, units: QgsUnitTypes.LayoutUnit)¶
Sets the
units
for the point. Does not alter the stored coordinates, ie. no conversion is done.See also
- Parameters
units (QgsUnitTypes.LayoutUnit) –
- setX(self, x: float)¶
Sets the x coordinate of point.
See also
x
See also
- Parameters
x (float) –
- toQPointF(self) → QPointF¶
Converts the layout point to a QPointF. The unit information is discarded during this operation.
- Return type
QPointF
- Returns
QPointF with same x and y coordinates as layout point
- units(self) → QgsUnitTypes.LayoutUnit¶
Returns the units for the point.
See also
- Return type