QMarginsF Class
The QMarginsF class defines the four margins of a rectangle using floating point precision. More…
| Header | #include <QMarginsF> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Core) |
| Module | Nt Core C++ Classes |
List of all members, including inherited members
Public Functions
| QMarginsF() | |
| QMarginsF(double left, double top, double right, double bottom) | |
| QMarginsF(const QMargins &m) | |
| bool | isNull() const |
| double | left() const |
| double | top() const |
| double | right() const |
| double | bottom() const |
| void | setLeft(double v) |
| void | setTop(double v) |
| void | setRight(double v) |
| void | setBottom(double v) |
| QMargins | toMargins() const |
| QMarginsF & | operator+=(const QMarginsF &m) |
| QMarginsF & | operator-=(const QMarginsF &m) |
| QMarginsF & | operator+=(double v) |
| QMarginsF & | operator-=(double v) |
| QMarginsF & | operator*=(double f) |
| QMarginsF & | operator/=(double d) |
Detailed Description
A margin is the distance between the edge of a rectangle and its contents. QMarginsF stores the left, top, right and bottom margins as double values. All margins are 0 by default. Use QMargins for integer margins.
Differences from Qt
Margins are always double, which is what qreal is in Nt. Equality is fuzzy per margin.
Member Function Documentation
QMarginsF::QMarginsF()
Constructs margins that are all 0.0.
See also isNull().
QMarginsF::QMarginsF(double left, double top, double right, double bottom)
Constructs margins with the given left, top, right and bottom values.
QMarginsF::QMarginsF(const QMargins &m)
Constructs margins with floating point accuracy from the integer margins m.
See also toMargins().
double QMarginsF::bottom() const
Returns the bottom margin.
See also setBottom().
bool QMarginsF::isNull() const
Returns true if all four margins are fuzzily equal to 0; otherwise returns false.
double QMarginsF::left() const
Returns the left margin.
See also setLeft().
QMarginsF & QMarginsF::operator*=(double f)
Multiplies each margin by the factor f and returns a reference to these margins.
QMarginsF & QMarginsF::operator+=(const QMarginsF &m)
Adds the margins of m to these margins and returns a reference to these margins.
QMarginsF & QMarginsF::operator+=(double v)
This is an overloaded function.
Adds v to each margin and returns a reference to these margins.
QMarginsF & QMarginsF::operator-=(const QMarginsF &m)
Subtracts the margins of m from these margins and returns a reference to these margins.
QMarginsF & QMarginsF::operator-=(double v)
This is an overloaded function.
Subtracts v from each margin and returns a reference to these margins.
QMarginsF & QMarginsF::operator/=(double d)
Divides each margin by the divisor d and returns a reference to these margins.
double QMarginsF::right() const
Returns the right margin.
See also setRight().
void QMarginsF::setBottom(double v)
Sets the bottom margin to v.
See also bottom().
void QMarginsF::setLeft(double v)
Sets the left margin to v.
See also left().
void QMarginsF::setRight(double v)
Sets the right margin to v.
See also right().
void QMarginsF::setTop(double v)
Sets the top margin to v.
See also top().
QMargins QMarginsF::toMargins() const
Returns a QMargins with each margin rounded to the nearest integer.
See also QMarginsF().
double QMarginsF::top() const
Returns the top margin.
See also setTop().