QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
QgsMargins Class Reference

The QgsMargins class defines the four margins of a rectangle. More...

#include <qgsmargins.h>

Public Member Functions

 QgsMargins ()=default
 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.
 
double bottom () const
 Returns the bottom margin.
 
bool isNull () const
 Returns true if all margins are is 0; otherwise returns false.
 
double left () const
 Returns the left margin.
 
QgsMarginsoperator*= (double factor)
 Multiplies each component of this object by factor and returns a reference to it.
 
QgsMarginsoperator+= (const QgsMargins &margins)
 Add each component of margins to the respective component of this object and returns a reference to it.
 
QgsMarginsoperator+= (double addend)
 Adds the addend to each component of this object and returns a reference to it.
 
QgsMarginsoperator-= (const QgsMargins &margins)
 Subtract each component of margins from the respective component of this object and returns a reference to it.
 
QgsMarginsoperator-= (double subtrahend)
 Subtracts the subtrahend from each component of this object and returns a reference to it.
 
QgsMarginsoperator/= (double divisor)
 Multiplies each component of this object by factor and returns a reference to it.
 
double right () const
 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.
 
double top () const
 Returns the top margin.
 
QString toString () const
 Returns the margins encoded to a string.
 

Static Public Member Functions

static 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.
 

Detailed Description

The QgsMargins class defines the four margins of a rectangle.

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.

Definition at line 36 of file qgsmargins.h.

Constructor & Destructor Documentation

◆ QgsMargins() [1/2]

QgsMargins::QgsMargins ( )
default

Constructs a margins object with all margins set to 0.

◆ QgsMargins() [2/2]

QgsMargins::QgsMargins ( double  left,
double  top,
double  right,
double  bottom 
)
inline

Constructs margins with the given left, top, right, bottom.

See also
setLeft()
setRight()
setTop()
setBottom()

Definition at line 52 of file qgsmargins.h.

Member Function Documentation

◆ bottom()

double QgsMargins::bottom ( ) const
inline

Returns the bottom margin.

See also
setBottom()

Definition at line 89 of file qgsmargins.h.

◆ fromString()

QgsMargins QgsMargins::fromString ( const QString &  string)
static

Returns a QgsMargins object decoded from a string, or a null QgsMargins if the string could not be interpreted as margins.

See also
toString()

Definition at line 27 of file qgsmargins.cpp.

◆ isNull()

bool QgsMargins::isNull ( ) const
inline

Returns true if all margins are is 0; otherwise returns false.

Definition at line 62 of file qgsmargins.h.

◆ left()

double QgsMargins::left ( ) const
inline

Returns the left margin.

See also
setLeft()

Definition at line 71 of file qgsmargins.h.

◆ operator*=()

QgsMargins & QgsMargins::operator*= ( double  factor)
inline

Multiplies each component of this object by factor and returns a reference to it.

Definition at line 303 of file qgsmargins.h.

◆ operator+=() [1/2]

QgsMargins & QgsMargins::operator+= ( const QgsMargins margins)
inline

Add each component of margins to the respective component of this object and returns a reference to it.

Definition at line 275 of file qgsmargins.h.

◆ operator+=() [2/2]

QgsMargins & QgsMargins::operator+= ( double  addend)
inline

Adds the addend to each component of this object and returns a reference to it.

Definition at line 285 of file qgsmargins.h.

◆ operator-=() [1/2]

QgsMargins & QgsMargins::operator-= ( const QgsMargins margins)
inline

Subtract each component of margins from the respective component of this object and returns a reference to it.

Definition at line 280 of file qgsmargins.h.

◆ operator-=() [2/2]

QgsMargins & QgsMargins::operator-= ( double  subtrahend)
inline

Subtracts the subtrahend from each component of this object and returns a reference to it.

Definition at line 294 of file qgsmargins.h.

◆ operator/=()

QgsMargins & QgsMargins::operator/= ( double  divisor)
inline

Multiplies each component of this object by factor and returns a reference to it.

Definition at line 308 of file qgsmargins.h.

◆ right()

double QgsMargins::right ( ) const
inline

Returns the right margin.

See also
setRight()

Definition at line 83 of file qgsmargins.h.

◆ setBottom()

void QgsMargins::setBottom ( double  bottom)
inline

Sets the bottom margin to bottom.

See also
bottom()

Definition at line 113 of file qgsmargins.h.

◆ setLeft()

void QgsMargins::setLeft ( double  left)
inline

Sets the left margin to left.

See also
left()

Definition at line 95 of file qgsmargins.h.

◆ setRight()

void QgsMargins::setRight ( double  right)
inline

Sets the right margin to right.

See also
right()

Definition at line 107 of file qgsmargins.h.

◆ setTop()

void QgsMargins::setTop ( double  top)
inline

Sets the top margin to top.

See also
top()

Definition at line 101 of file qgsmargins.h.

◆ top()

double QgsMargins::top ( ) const
inline

Returns the top margin.

See also
setTop()

Definition at line 77 of file qgsmargins.h.

◆ toString()

QString QgsMargins::toString ( ) const

Returns the margins encoded to a string.

See also
fromString()

Definition at line 18 of file qgsmargins.cpp.


The documentation for this class was generated from the following files: