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