6.0.0-rc4Source

QMarginsF Class

The QMarginsF class defines the four margins of a rectangle using floating point precision. More…

Header#include <QMarginsF>
CMaketarget_link_libraries(app PRIVATE Nt::Core)
ModuleNt 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)
boolisNull() const
doubleleft() const
doubletop() const
doubleright() const
doublebottom() const
voidsetLeft(double v)
voidsetTop(double v)
voidsetRight(double v)
voidsetBottom(double v)
QMarginstoMargins() 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.

See also QMargins and QRectF.

Differences from Qt

Margins are always double, which is what qreal is in Nt. Equality is fuzzy per margin.

Member Function Documentation

[constexpr] QMarginsF::QMarginsF()

Constructs margins that are all 0.0.

See also isNull().

[constexpr] QMarginsF::QMarginsF(double left, double top, double right, double bottom)

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

[constexpr] QMarginsF::QMarginsF(const QMargins &m)

Constructs margins with floating point accuracy from the integer margins m.

See also toMargins().

[constexpr] 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.

[constexpr] double QMarginsF::left() const

Returns the left margin.

See also setLeft().

[constexpr] QMarginsF & QMarginsF::operator*=(double f)

Multiplies each margin by the factor f and returns a reference to these margins.

[constexpr] QMarginsF & QMarginsF::operator+=(const QMarginsF &m)

Adds the margins of m to these margins and returns a reference to these margins.

[constexpr] QMarginsF & QMarginsF::operator+=(double v)

This is an overloaded function.

Adds v to each margin and returns a reference to these margins.

[constexpr] QMarginsF & QMarginsF::operator-=(const QMarginsF &m)

Subtracts the margins of m from these margins and returns a reference to these margins.

[constexpr] QMarginsF & QMarginsF::operator-=(double v)

This is an overloaded function.

Subtracts v from each margin and returns a reference to these margins.

[constexpr] QMarginsF & QMarginsF::operator/=(double d)

Divides each margin by the divisor d and returns a reference to these margins.

Returns the right margin.

See also setRight().

[constexpr] void QMarginsF::setBottom(double v)

Sets the bottom margin to v.

See also bottom().

[constexpr] void QMarginsF::setLeft(double v)

Sets the left margin to v.

See also left().

[constexpr] void QMarginsF::setRight(double v)

Sets the right margin to v.

See also right().

[constexpr] 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().

[constexpr] double QMarginsF::top() const

Returns the top margin.

See also setTop().