QtBase  v6.3.1
Public Member Functions | Friends | Related Functions | List of all members
QMarginsF Class Reference

The QMarginsF class defines the four margins of a rectangle. More...

#include <qmargins.h>

Public Member Functions

constexpr QMarginsF () noexcept
 
constexpr QMarginsF (qreal left, qreal top, qreal right, qreal bottom) noexcept
 
constexpr QMarginsF (const QMargins &margins) noexcept
 
constexpr bool isNull () const noexcept
 
constexpr qreal left () const noexcept
 
constexpr qreal top () const noexcept
 
constexpr qreal right () const noexcept
 
constexpr qreal bottom () const noexcept
 
constexpr void setLeft (qreal aleft) noexcept
 
constexpr void setTop (qreal atop) noexcept
 
constexpr void setRight (qreal aright) noexcept
 
constexpr void setBottom (qreal abottom) noexcept
 
constexpr QMarginsFoperator+= (const QMarginsF &margins) noexcept
 
constexpr QMarginsFoperator-= (const QMarginsF &margins) noexcept
 
constexpr QMarginsFoperator+= (qreal addend) noexcept
 
constexpr QMarginsFoperator-= (qreal subtrahend) noexcept
 
constexpr QMarginsFoperator*= (qreal factor) noexcept
 
constexpr QMarginsFoperator/= (qreal divisor)
 
constexpr QMargins toMargins () const noexcept
 

Friends

constexpr friend bool operator== (const QMarginsF &lhs, const QMarginsF &rhs) noexcept
 
constexpr friend bool operator!= (const QMarginsF &lhs, const QMarginsF &rhs) noexcept
 

Related Functions

(Note that these are not member functions.)

const QMarginsF operator+ (const QMarginsF &lhs, const QMarginsF &rhs)
 
const QMarginsF operator- (const QMarginsF &lhs, const QMarginsF &rhs)
 
const QMarginsF operator+ (const QMarginsF &lhs, qreal rhs)
 
const QMarginsF operator+ (qreal lhs, const QMarginsF &rhs)
 
const QMarginsF operator- (const QMarginsF &lhs, qreal rhs)
 
const QMarginsF operator* (const QMarginsF &lhs, qreal rhs)
 
const QMarginsF operator* (qreal lhs, const QMarginsF &rhs)
 
const QMarginsF operator/ (const QMarginsF &lhs, qreal rhs)
 
QMarginsF operator| (const QMarginsF &m1, const QMarginsF &m2)
 
QMarginsF operator+ (const QMarginsF &margins)
 
QMarginsF operator- (const QMarginsF &margins)
 
QDataStreamoperator<< (QDataStream &stream, const QMarginsF &m)
 
QDataStreamoperator>> (QDataStream &stream, QMarginsF &m)
 

Detailed Description

The QMarginsF class defines the four margins of a rectangle.

\inmodule QtCore

Since
5.3

QMarginsF defines a set of four margins; left, top, right, and bottom, that describe the finite size of the borders surrounding a rectangle.

The isNull() function returns true only if all margins are very close to zero.

QMarginsF objects can be streamed as well as compared.

Definition at line 300 of file qmargins.h.

Constructor & Destructor Documentation

◆ QMarginsF() [1/3]

constexpr QMarginsF::QMarginsF ( )
inlineconstexprnoexcept

Constructs a margins object with all margins set to 0.

See also
isNull()

Definition at line 379 of file qmargins.h.

◆ QMarginsF() [2/3]

constexpr QMarginsF::QMarginsF ( qreal  left,
qreal  top,
qreal  right,
qreal  bottom 
)
inlineconstexprnoexcept

Constructs margins with the given left, top, right, and bottom. All parameters must be finite.

See also
setLeft(), setRight(), setTop(), setBottom()

Definition at line 382 of file qmargins.h.

◆ QMarginsF() [3/3]

constexpr QMarginsF::QMarginsF ( const QMargins margins)
inlineconstexprnoexcept

Constructs margins copied from the given margins.

Definition at line 385 of file qmargins.h.

Member Function Documentation

◆ bottom()

constexpr qreal QMarginsF::bottom ( ) const
inlineconstexprnoexcept

Returns the bottom margin.

Definition at line 400 of file qmargins.h.

Here is the caller graph for this function:

◆ isNull()

constexpr bool QMarginsF::isNull ( ) const
inlineconstexprnoexcept

Returns true if all margins are very close to 0; otherwise returns false.

See also
{<QtGlobal>::}{qFuzzyIsNull}

Definition at line 388 of file qmargins.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ left()

constexpr qreal QMarginsF::left ( ) const
inlineconstexprnoexcept

Returns the left margin.

See also
setLeft()

Definition at line 391 of file qmargins.h.

Here is the caller graph for this function:

◆ operator*=()

constexpr QMarginsF & QMarginsF::operator*= ( qreal  factor)
inlineconstexprnoexcept

Multiplies each component of this object by the given finite factor and returns a reference to this object.

See also
operator/=()

Definition at line 499 of file qmargins.h.

◆ operator+=() [1/2]

constexpr QMarginsF & QMarginsF::operator+= ( const QMarginsF margins)
inlineconstexprnoexcept

Add each component of margins to the respective component of this object and returns a reference to it.

See also
operator-=()

Definition at line 471 of file qmargins.h.

◆ operator+=() [2/2]

constexpr QMarginsF & QMarginsF::operator+= ( qreal  addend)
inlineconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Adds the given finite addend to each component of this object and returns a reference to it.

See also
operator-=()

Definition at line 481 of file qmargins.h.

◆ operator-=() [1/2]

constexpr QMarginsF & QMarginsF::operator-= ( const QMarginsF margins)
inlineconstexprnoexcept

Subtract each component of margins from the respective component of this object and returns a reference to it.

See also
operator+=()

Definition at line 476 of file qmargins.h.

◆ operator-=() [2/2]

constexpr QMarginsF & QMarginsF::operator-= ( qreal  subtrahend)
inlineconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Subtracts the given finite subtrahend from each component of this object and returns a reference to it.

See also
operator+=()

Definition at line 490 of file qmargins.h.

◆ operator/=()

constexpr QMarginsF & QMarginsF::operator/= ( qreal  divisor)
inlineconstexpr

Divides each component of this object by divisor and returns a reference to this object.

The divisor must not be either zero or NaN.

See also
operator*=()

Definition at line 504 of file qmargins.h.

◆ right()

constexpr qreal QMarginsF::right ( ) const
inlineconstexprnoexcept

Returns the right margin.

Definition at line 397 of file qmargins.h.

Here is the caller graph for this function:

◆ setBottom()

constexpr void QMarginsF::setBottom ( qreal  abottom)
inlineconstexprnoexcept

Sets the bottom margin to abottom (which must be finite).

Definition at line 413 of file qmargins.h.

Here is the caller graph for this function:

◆ setLeft()

constexpr void QMarginsF::setLeft ( qreal  aleft)
inlineconstexprnoexcept

Sets the left margin to aleft (which must be finite).

Definition at line 404 of file qmargins.h.

Here is the caller graph for this function:

◆ setRight()

constexpr void QMarginsF::setRight ( qreal  aright)
inlineconstexprnoexcept

Sets the right margin to aright (which must be finite).

Definition at line 410 of file qmargins.h.

Here is the caller graph for this function:

◆ setTop()

constexpr void QMarginsF::setTop ( qreal  atop)
inlineconstexprnoexcept

Sets the top margin to atop (which must be finite).

Definition at line 407 of file qmargins.h.

Here is the caller graph for this function:

◆ toMargins()

constexpr QMargins QMarginsF::toMargins ( ) const
inlineconstexprnoexcept

Returns an integer-based copy of this margins object.

Note that the components in the returned margins will be rounded to the nearest integer.

See also
QMarginsF()

Definition at line 519 of file qmargins.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ top()

constexpr qreal QMarginsF::top ( ) const
inlineconstexprnoexcept

Returns the top margin.

See also
setTop()

Definition at line 394 of file qmargins.h.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator!=

bool QMarginsF::operator!= ( const QMarginsF lhs,
const QMarginsF rhs 
)
friend

Returns true if lhs and rhs are sufficiently different; otherwise returns false.

Warning
This function does not check for strict inequality; instead, it uses a fuzzy comparison to compare the margins.
See also
qFuzzyCompare

Definition at line 342 of file qmargins.h.

◆ operator*() [1/2]

const QMarginsF operator* ( const QMarginsF lhs,
qreal  rhs 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns a QMarginsF object that is formed by multiplying each component of the given lhs margins by finite factor rhs.

See also
QMarginsF::operator*=(), QMarginsF::operator/=()

Definition at line 446 of file qmargins.h.

◆ operator*() [2/2]

const QMarginsF operator* ( qreal  lhs,
const QMarginsF rhs 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns a QMarginsF object that is formed by multiplying each component of the given lhs margins by finite factor rhs.

See also
QMarginsF::operator*=(), QMarginsF::operator/=()

Definition at line 452 of file qmargins.h.

◆ operator+() [1/4]

const QMarginsF operator+ ( const QMarginsF lhs,
const QMarginsF rhs 
)
related

Returns a QMarginsF object that is the sum of the given margins, lhs and rhs; each component is added separately.

See also
QMarginsF::operator+=(), QMarginsF::operator-=()

Definition at line 416 of file qmargins.h.

◆ operator+() [2/4]

const QMarginsF operator+ ( const QMarginsF lhs,
qreal  rhs 
)
related

Returns a QMarginsF object that is formed by adding rhs (which must be finite) to each component of lhs.

See also
QMarginsF::operator+=(), QMarginsF::operator-=()

Definition at line 428 of file qmargins.h.

◆ operator+() [3/4]

QMarginsF operator+ ( const QMarginsF margins)
related

Returns a QMargin object that is formed from all components of margins.

Definition at line 509 of file qmargins.h.

◆ operator+() [4/4]

const QMarginsF operator+ ( qreal  lhs,
const QMarginsF rhs 
)
related

Returns a QMarginsF object that is formed by adding lhs (which must be finite) to each component of rhs.

See also
QMarginsF::operator+=(), QMarginsF::operator-=()

Definition at line 434 of file qmargins.h.

◆ operator-() [1/3]

const QMarginsF operator- ( const QMarginsF lhs,
const QMarginsF rhs 
)
related

Returns a QMarginsF object that is formed by subtracting rhs from lhs; each component is subtracted separately.

See also
QMarginsF::operator+=(), QMarginsF::operator-=()

Definition at line 422 of file qmargins.h.

◆ operator-() [2/3]

const QMarginsF operator- ( const QMarginsF lhs,
qreal  rhs 
)
related

Returns a QMarginsF object that is formed by subtracting rhs (which must be finite) from each component of lhs.

See also
QMarginsF::operator+=(), QMarginsF::operator-=()

Definition at line 440 of file qmargins.h.

◆ operator-() [3/3]

QMarginsF operator- ( const QMarginsF margins)
related

Returns a QMargin object that is formed by negating all components of margins.

Definition at line 514 of file qmargins.h.

Here is the call graph for this function:

◆ operator/()

const QMarginsF operator/ ( const QMarginsF lhs,
qreal  rhs 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns a QMarginsF object that is formed by dividing the components of the given lhs margins by the given rhs divisor.

The divisor must not be either zero or NaN.

See also
QMarginsF::operator*=(), QMarginsF::operator/=()

Definition at line 458 of file qmargins.h.

Here is the call graph for this function:

◆ operator<<()

QDataStream & operator<< ( QDataStream stream,
const QMarginsF m 
)
related

Writes margin m to the given stream and returns a reference to the stream.

See also
{Serializing Qt Data Types}

Definition at line 788 of file qmargins.cpp.

◆ operator==

bool QMarginsF::operator== ( const QMarginsF lhs,
const QMarginsF rhs 
)
friend

Returns true if lhs and rhs are approximately equal; otherwise returns false.

Warning
This function does not check for strict equality; instead, it uses a fuzzy comparison to compare the margins.
See also
qFuzzyCompare

Definition at line 334 of file qmargins.h.

◆ operator>>()

QDataStream & operator>> ( QDataStream stream,
QMarginsF m 
)
related

Reads a margin from the given stream into margin m and returns a reference to the stream.

See also
{Serializing Qt Data Types}

Definition at line 804 of file qmargins.cpp.

◆ operator|()

QMarginsF operator| ( const QMarginsF m1,
const QMarginsF m2 
)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns a QMarginsF object that is formed from the maximum of each component of m2 and m1.

See also
QMarginsF::operator+=(), QMarginsF::operator-=()
Since
6.0

Definition at line 465 of file qmargins.h.


The documentation for this class was generated from the following files: