QgsMargins class
The QgsMargins class defines the four margins of a rectangle.
Contents
QgsMargins defines a set of four margins; left, top, right and bottom, that describe the size of the borders surrounding a rectangle.
The isNull() function returns true only if all margins are set to zero.
Public static functions
- static auto fromString(const QString& string) -> QgsMargins
- Returns a QgsMargins object decoded from a string, or a null QgsMargins if the string could not be interpreted as margins.
Constructors, destructors, conversion operators
- QgsMargins() defaulted
- Constructs a margins object with all margins set to 0.
- QgsMargins(double left, double top, double right, double bottom)
- Constructs margins with the given left, top, right, bottom.
Public functions
- auto bottom() const -> double
- Returns the bottom margin.
- auto isNull() const -> bool
- Returns
trueif all margins are is 0; otherwise returns false. - auto left() const -> double
- Returns the left margin.
- auto operator*=(double factor) -> QgsMargins&
- Multiplies each component of this object by factor and returns a reference to it.
- auto operator+=(const QgsMargins& margins) -> QgsMargins&
- Add each component of margins to the respective component of this object and returns a reference to it.
- auto operator+=(double addend) -> QgsMargins&
- Adds the addend to each component of this object and returns a reference to it.
- auto operator-=(const QgsMargins& margins) -> QgsMargins&
- Subtract each component of margins from the respective component of this object and returns a reference to it.
- auto operator-=(double subtrahend) -> QgsMargins&
- Subtracts the subtrahend from each component of this object and returns a reference to it.
- auto operator/=(double divisor) -> QgsMargins&
- Multiplies each component of this object by factor and returns a reference to it.
- auto right() const -> double
- Returns the right margin.
- void setBottom(double bottom)
- Sets the bottom margin to bottom.
- void setLeft(double left)
- Sets the left margin to left.
- void setRight(double right)
- Sets the right margin to right.
- void setTop(double top)
- Sets the top margin to top.
- auto top() const -> double
- Returns the top margin.
- auto toString() const -> QString
- Returns the margins encoded to a string.
Function documentation
static QgsMargins QgsMargins:: fromString(const QString& string)
Returns a QgsMargins object decoded from a string, or a null QgsMargins if the string could not be interpreted as margins.
QgsMargins:: QgsMargins(double left,
double top,
double right,
double bottom)
Constructs margins with the given left, top, right, bottom.
double QgsMargins:: bottom() const
Returns the bottom margin.
double QgsMargins:: left() const
Returns the left margin.
double QgsMargins:: right() const
Returns the right margin.
void QgsMargins:: setBottom(double bottom)
Sets the bottom margin to bottom.
void QgsMargins:: setLeft(double left)
Sets the left margin to left.
void QgsMargins:: setRight(double right)
Sets the right margin to right.
void QgsMargins:: setTop(double top)
Sets the top margin to top.
double QgsMargins:: top() const
Returns the top margin.
QString QgsMargins:: toString() const
Returns the margins encoded to a string.