QMargins 类

QMargins 类定义矩形的 4 边距。 更多...

头: #include <QMargins>
CMake: find_package(Qt6 COMPONENTS Core REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Core)
qmake: QT += core

公共函数

  QMargins (int left , int top , int right , int bottom )
  QMargins ()
int bottom () const
bool isNull () const
int left () const
int right () const
void setBottom (int bottom )
void setLeft (int left )
void setRight (int right )
void setTop (int Top )
int top () const
QMargins & operator*= (int factor )
QMargins & operator*= (qreal factor )
QMargins & operator+= (const QMargins & margins )
QMargins & operator+= (int addend )
QMargins & operator-= (const QMargins & margins )
QMargins & operator-= (int subtrahend )
QMargins & operator/= (int divisor )
QMargins & operator/= (qreal divisor )
bool operator!= (const QMargins & m1 , const QMargins & m2 )
QMargins operator* (const QMargins & margins , int factor )
QMargins operator* (int factor , const QMargins & margins )
QMargins operator* (const QMargins & margins , qreal factor )
QMargins operator* (qreal factor , const QMargins & margins )
QMargins operator+ (const QMargins & m1 , const QMargins & m2 )
QMargins operator+ (const QMargins & lhs , int rhs )
QMargins operator+ (int lhs , const QMargins & rhs )
QMargins operator+ (const QMargins & margins )
QMargins operator- (const QMargins & m1 , const QMargins & m2 )
QMargins operator- (const QMargins & lhs , int rhs )
QMargins operator- (const QMargins & margins )
QMargins operator/ (const QMargins & margins , int divisor )
QMargins operator/ (const QMargins & margins , qreal divisor )
QDataStream & operator<< (QDataStream & stream , const QMargins & m )
bool operator== (const QMargins & m1 , const QMargins & m2 )
QDataStream & operator>> (QDataStream & stream , QMargins & m )
QMargins operator| (const QMargins & m1 , const QMargins & m2 )

详细描述

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

isNull () 函数返回 true only if all margins are set to zero.

QMargin objects can be streamed as well as compared.

成员函数文档编制

QMargins:: QMargins ( int left , int top , int right , int bottom )

构造边距采用给定 left , top , right ,和 bottom

另请参阅 setLeft (), setRight (), setTop (),和 setBottom ().

QMargins:: QMargins ()

Constructs a margins object with all margins set to 0.

另请参阅 isNull ().

int QMargins:: bottom () const

返回下边距。

另请参阅 setBottom ().

bool QMargins:: isNull () const

返回 true if all margins are is 0; otherwise returns false.

int QMargins:: left () const

返回左边距。

另请参阅 setLeft ().

int QMargins:: right () const

返回右边距。

另请参阅 setRight ().

void QMargins:: setBottom ( int bottom )

将下边距设为 bottom .

另请参阅 bottom ().

void QMargins:: setLeft ( int left )

将左边距设为 left .

另请参阅 left ().

void QMargins:: setRight ( int right )

将右边距设为 right .

另请参阅 right ().

void QMargins:: setTop ( int Top )

将上边距设为 Top .

另请参阅 top ().

int QMargins:: top () const

Returns the top margin.

另请参阅 setTop ().

[since 5.1] QMargins &QMargins:: operator*= ( int factor )

Multiplies each component of this object by factor and returns a reference to it.

该函数在 Qt 5.1 引入。

另请参阅 operator/= ().

[since 5.1] QMargins &QMargins:: operator*= ( qreal factor )

这是重载函数。

Multiplies each component of this object by factor and returns a reference to it.

该函数在 Qt 5.1 引入。

另请参阅 operator/= ().

[since 5.1] QMargins &QMargins:: operator+= (const QMargins & margins )

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

该函数在 Qt 5.1 引入。

另请参阅 operator-= ().

QMargins &QMargins:: operator+= ( int addend )

这是重载函数。

添加 addend to each component of this object and returns a reference to it.

另请参阅 operator-= ().

[since 5.1] QMargins &QMargins:: operator-= (const QMargins & margins )

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

该函数在 Qt 5.1 引入。

另请参阅 operator+= ().

QMargins &QMargins:: operator-= ( int subtrahend )

这是重载函数。

减去 subtrahend from each component of this object and returns a reference to it.

另请参阅 operator+= ().

[since 5.1] QMargins &QMargins:: operator/= ( int divisor )

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

该函数在 Qt 5.1 引入。

另请参阅 operator*= ().

[since 5.1] QMargins &QMargins:: operator/= ( qreal divisor )

这是重载函数。

该函数在 Qt 5.1 引入。

另请参阅 operator*= ().

相关非成员

bool operator!= (const QMargins & m1 , const QMargins & m2 )

返回 true if m1 and m2 are different; otherwise returns false .

[since 5.1] QMargins operator* (const QMargins & margins , int factor )

返回 QMargins object that is formed by multiplying each component of the given margins by factor .

该函数在 Qt 5.1 引入。

另请参阅 QMargins::operator*= () 和 QMargins::operator/= ().

[since 5.1] QMargins operator* ( int factor , const QMargins & margins )

这是重载函数。

返回 QMargins object that is formed by multiplying each component of the given margins by factor .

该函数在 Qt 5.1 引入。

另请参阅 QMargins::operator*= () 和 QMargins::operator/= ().

[since 5.1] QMargins operator* (const QMargins & margins , qreal factor )

这是重载函数。

返回 QMargins object that is formed by multiplying each component of the given margins by factor .

该函数在 Qt 5.1 引入。

另请参阅 QMargins::operator*= () 和 QMargins::operator/= ().

[since 5.1] QMargins operator* ( qreal factor , const QMargins & margins )

这是重载函数。

返回 QMargins object that is formed by multiplying each component of the given margins by factor .

该函数在 Qt 5.1 引入。

另请参阅 QMargins::operator*= () 和 QMargins::operator/= ().

[since 5.1] QMargins operator+ (const QMargins & m1 , const QMargins & m2 )

返回 QMargins object that is the sum of the given margins, m1 and m2 ;分别相加各分量。

该函数在 Qt 5.1 引入。

另请参阅 QMargins::operator+= () 和 QMargins::operator-= ().

[since 5.3] QMargins operator+ (const QMargins & lhs , int rhs )

返回 QMargins object that is formed by adding rhs to lhs .

该函数在 Qt 5.3 引入。

另请参阅 QMargins::operator+= () 和 QMargins::operator-= ().

[since 5.3] QMargins operator+ ( int lhs , const QMargins & rhs )

返回 QMargins object that is formed by adding lhs to rhs .

该函数在 Qt 5.3 引入。

另请参阅 QMargins::operator+= () 和 QMargins::operator-= ().

[since 5.3] QMargins operator+ (const QMargins & margins )

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

该函数在 Qt 5.3 引入。

[since 5.1] QMargins operator- (const QMargins & m1 , const QMargins & m2 )

返回 QMargins 对象的形成是通过减去 m2 from m1 ;分别减去各分量。

该函数在 Qt 5.1 引入。

另请参阅 QMargins::operator+= () 和 QMargins::operator-= ().

[since 5.3] QMargins operator- (const QMargins & lhs , int rhs )

返回 QMargins 对象的形成是通过减去 rhs from lhs .

该函数在 Qt 5.3 引入。

另请参阅 QMargins::operator+= () 和 QMargins::operator-= ().

[since 5.1] QMargins operator- (const QMargins & margins )

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

该函数在 Qt 5.1 引入。

[since 5.1] QMargins operator/ (const QMargins & margins , int divisor )

返回 QMargins object that is formed by dividing the components of the given margins 通过给定 divisor .

该函数在 Qt 5.1 引入。

另请参阅 QMargins::operator*= () 和 QMargins::operator/= ().

[since 5.1] QMargins operator/ (const QMargins & margins , qreal divisor )

这是重载函数。

返回 QMargins object that is formed by dividing the components of the given margins 通过给定 divisor .

该函数在 Qt 5.1 引入。

另请参阅 QMargins::operator*= () 和 QMargins::operator/= ().

QDataStream & operator<< ( QDataStream & stream , const QMargins & m )

Writes margin m 到给定 stream 并返回流引用。

另请参阅 序列化 Qt 数据类型 .

bool operator== (const QMargins & m1 , const QMargins & m2 )

返回 true if m1 and m2 相等;否则返回 false .

QDataStream & operator>> ( QDataStream & stream , QMargins & m )

Reads a margin from the given stream into margin m 并返回流引用。

另请参阅 序列化 Qt 数据类型 .

[since 6.0] QMargins operator| (const QMargins & m1 , const QMargins & m2 )

返回 QMargins object that is formed from the maximum of each component of m2 and m1 .

该函数在 Qt 6.0 引入。

另请参阅 QMargins::operator+= () 和 QMargins::operator-= ().