QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
19 #include "qgis_core.h"
53 QgsMargins(
double left,
double top,
double right,
double bottom )
72 double left()
const {
return mLeft; }
78 double top()
const {
return mTop; }
84 double right()
const {
return mRight; }
90 double bottom()
const {
return mBottom; }
96 void setLeft(
double left ) { mLeft = left; }
102 void setTop(
double top ) { mTop = top; }
131 inline QgsMargins &operator+=(
double addend );
137 inline QgsMargins &operator-=(
double subtrahend );
143 inline QgsMargins &operator*=(
double factor );
149 inline QgsMargins &operator/=(
double divisor );
155 QString toString()
const;
162 static QgsMargins fromString(
const QString &
string );
168 double mBottom = 0.0;
245 margins.
right() * factor, margins.
bottom() * factor );
255 margins.
right() * factor, margins.
bottom() * factor );
265 margins.
right() / divisor, margins.
bottom() / divisor );
270 return *
this = *
this + margins;
275 return *
this = *
this - margins;
291 mRight -= subtrahend;
292 mBottom -= subtrahend;
298 return *
this = *
this * factor;
303 return *
this = *
this / divisor;
324 #endif // QGSMARGINS_H
double bottom() const
Returns the bottom margin.
QgsMargins operator-(const QgsMargins &m1, const QgsMargins &m2)
Returns a QgsMargins object that is formed by subtracting m2 from m1; each component is subtracted se...
double top() const
Returns the top margin.
QgsMargins operator+(const QgsMargins &m1, const QgsMargins &m2)
Returns a QgsMargins object that is the sum of the given margins, m1 and m2; each component is added ...
QgsMargins operator/(const QgsMargins &margins, double divisor)
Returns a QgsMargins object that is formed by dividing the components of the given margins by the giv...
void setLeft(double left)
Sets the left margin to left.
double left() const
Returns the left margin.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
QgsMargins & operator+=(const QgsMargins &margins)
Add each component of margins to the respective component of this object and returns a reference to i...
QgsMargins & operator/=(double divisor)
Multiplies each component of this object by factor and returns a reference to it.
bool isNull() const
Returns true if all margins are is 0; otherwise returns false.
void setRight(double right)
Sets the right margin to right.
QgsMargins operator*(const QgsMargins &margins, double factor)
Returns a QgsMargins object that is formed by multiplying each component of the given margins by fact...
The QgsMargins class defines the four margins of a rectangle.
void setBottom(double bottom)
Sets the bottom margin to bottom.
double right() const
Returns the right margin.
Q_DECLARE_TYPEINFO(QgsMargins, Q_MOVABLE_TYPE)
QgsMargins(double left, double top, double right, double bottom)
Constructs margins with the given left, top, right, bottom.
bool operator==(const QgsMargins &lhs, const QgsMargins &rhs)
Returns true if lhs and rhs are equal; otherwise returns false.
QgsMargins & operator*=(double factor)
Multiplies each component of this object by factor and returns a reference to it.
bool operator!=(const QgsMargins &lhs, const QgsMargins &rhs)
Returns true if lhs and rhs are different; otherwise returns false.
void setTop(double top)
Sets the top margin to top.
QgsMargins & operator-=(const QgsMargins &margins)
Subtract each component of margins from the respective component of this object and returns a referen...