52 QgsMargins(
double left,
double top,
double right,
double bottom )
71 double left()
const {
return mLeft; }
77 double top()
const {
return mTop; }
83 double right()
const {
return mRight; }
89 double bottom()
const {
return mBottom; }
95 void setLeft(
double left ) { mLeft = left; }
101 void setTop(
double top ) { mTop = top; }
130 inline QgsMargins &operator+=(
double addend );
136 inline QgsMargins &operator-=(
double subtrahend );
142 inline QgsMargins &operator*=(
double factor );
148 inline QgsMargins &operator/=(
double divisor );
154 QString toString()
const;
161 static QgsMargins fromString(
const QString &
string );
164 SIP_PYOBJECT __repr__();
166 const QString str = QStringLiteral(
"<QgsMargins: %1 %2 %3 %4>" ).arg( sipCpp->left() ).arg( sipCpp->top() ).arg( sipCpp->right() ).arg( sipCpp->bottom() );
167 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
175 double mBottom = 0.0;
252 margins.
right() * factor, margins.
bottom() * factor );
262 margins.
right() * factor, margins.
bottom() * factor );
272 margins.
right() / divisor, margins.
bottom() / divisor );
277 return *
this = *
this + margins;
282 return *
this = *
this - margins;
298 mRight -= subtrahend;
299 mBottom -= subtrahend;
305 return *
this = *
this * factor;
310 return *
this = *
this / divisor;
The QgsMargins class defines the four margins of a rectangle.
QgsMargins()=default
Constructs a margins object with all margins set to 0.
void setBottom(double bottom)
Sets the bottom margin to bottom.
QgsMargins & operator*=(double factor)
Multiplies each component of this object by factor and returns a reference to it.
double top() const
Returns the top margin.
void setLeft(double left)
Sets the left margin to left.
bool isNull() const
Returns true if all margins are is 0; otherwise returns false.
double right() const
Returns the right margin.
double bottom() const
Returns the bottom margin.
QgsMargins & operator/=(double divisor)
Multiplies each component of this object by factor and returns a reference to it.
QgsMargins(double left, double top, double right, double bottom)
Constructs margins with the given left, top, right, bottom.
void setRight(double right)
Sets the right margin to right.
void setTop(double top)
Sets the top margin to top.
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-=(const QgsMargins &margins)
Subtract each component of margins from the respective component of this object and returns a referen...
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)
Q_DECLARE_TYPEINFO(QgsMargins, Q_MOVABLE_TYPE)
QgsMargins operator*(const QgsMargins &margins, double factor)
Returns a QgsMargins object that is formed by multiplying each component of the given margins by fact...
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...
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...
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 ...
bool operator!=(const QgsMargins &lhs, const QgsMargins &rhs)
Returns true if lhs and rhs are different; otherwise returns false.
bool operator==(const QgsMargins &lhs, const QgsMargins &rhs)
Returns true if lhs and rhs are equal; otherwise returns false.