Qt 4.8
Public Functions | Properties | Friends | List of all members
QMargins Class Reference

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

#include <qmargins.h>

Public Functions

int bottom () const
 Returns the bottom margin. More...
 
bool isNull () const
 Returns true if all margins are is 0; otherwise returns false. More...
 
int left () const
 Returns the left margin. More...
 
 QMargins ()
 Constructs a margins object with all margins set to 0. More...
 
 QMargins (int left, int top, int right, int bottom)
 Constructs margins with the given left, top, right, bottom. More...
 
int right () const
 Returns the right margin. More...
 
void setBottom (int bottom)
 Sets the bottom margin to bottom. More...
 
void setLeft (int left)
 Sets the left margin to left. More...
 
void setRight (int right)
 Sets the right margin to right. More...
 
void setTop (int top)
 Sets the Top margin to Top. More...
 
int top () const
 Returns the top margin. More...
 

Properties

int m_bottom
 
int m_left
 
int m_right
 
int m_top
 

Friends

bool operator!= (const QMargins &, const QMargins &)
 Returns true if m1 and m2 are different; otherwise returns false. More...
 
bool operator== (const QMargins &, const QMargins &)
 Returns true if m1 and m2 are equal; otherwise returns false. More...
 

Detailed Description

The QMargins class defines the four margins of a rectangle.

Since
4.6

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

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

QMargin objects can be streamed as well as compared.

Definition at line 53 of file qmargins.h.

Constructors and Destructors

◆ QMargins() [1/2]

QMargins::QMargins ( )
inline

Constructs a margins object with all margins set to 0.

See also
isNull()

Definition at line 87 of file qmargins.h.

88 { m_top = m_bottom = m_left = m_right = 0; }
int m_right
Definition: qmargins.h:74
int m_bottom
Definition: qmargins.h:75
int m_left
Definition: qmargins.h:72
int m_top
Definition: qmargins.h:73

◆ QMargins() [2/2]

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

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

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

Definition at line 90 of file qmargins.h.

91  : m_left(aleft), m_top(atop), m_right(aright), m_bottom(abottom) {}
int m_right
Definition: qmargins.h:74
int m_bottom
Definition: qmargins.h:75
int m_left
Definition: qmargins.h:72
int m_top
Definition: qmargins.h:73

Functions

◆ bottom()

int QMargins::bottom ( ) const
inline

◆ isNull()

bool QMargins::isNull ( ) const
inline

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

Definition at line 93 of file qmargins.h.

94 { return m_left==0 && m_top==0 && m_right==0 && m_bottom==0; }
int m_right
Definition: qmargins.h:74
int m_bottom
Definition: qmargins.h:75
int m_left
Definition: qmargins.h:72
int m_top
Definition: qmargins.h:73

◆ left()

int QMargins::left ( ) const
inline

◆ right()

int QMargins::right ( ) const
inline

◆ setBottom()

void QMargins::setBottom ( int  bottom)
inline

Sets the bottom margin to bottom.

Definition at line 118 of file qmargins.h.

119 { m_bottom = abottom; }
int m_bottom
Definition: qmargins.h:75

◆ setLeft()

void QMargins::setLeft ( int  left)
inline

Sets the left margin to left.

Definition at line 109 of file qmargins.h.

110 { m_left = aleft; }
int m_left
Definition: qmargins.h:72

◆ setRight()

void QMargins::setRight ( int  right)
inline

Sets the right margin to right.

Definition at line 115 of file qmargins.h.

116 { m_right = aright; }
int m_right
Definition: qmargins.h:74

◆ setTop()

void QMargins::setTop ( int  top)
inline

Sets the Top margin to Top.

Definition at line 112 of file qmargins.h.

113 { m_top = atop; }
int m_top
Definition: qmargins.h:73

◆ top()

int QMargins::top ( ) const
inline

Friends and Related Functions

◆ operator!=

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

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

Definition at line 130 of file qmargins.h.

131 {
132  return
133  m1.m_left != m2.m_left ||
134  m1.m_top != m2.m_top ||
135  m1.m_right != m2.m_right ||
136  m1.m_bottom != m2.m_bottom;
137 }
int m_right
Definition: qmargins.h:74
int m_bottom
Definition: qmargins.h:75
int m_left
Definition: qmargins.h:72
int m_top
Definition: qmargins.h:73

◆ operator==

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

Returns true if m1 and m2 are equal; otherwise returns false.

Definition at line 121 of file qmargins.h.

122 {
123  return
124  m1.m_left == m2.m_left &&
125  m1.m_top == m2.m_top &&
126  m1.m_right == m2.m_right &&
127  m1.m_bottom == m2.m_bottom;
128 }
int m_right
Definition: qmargins.h:74
int m_bottom
Definition: qmargins.h:75
int m_left
Definition: qmargins.h:72
int m_top
Definition: qmargins.h:73

Properties

◆ m_bottom

int QMargins::m_bottom
private

Definition at line 75 of file qmargins.h.

Referenced by bottom(), isNull(), operator!=(), operator==(), QMargins(), and setBottom().

◆ m_left

int QMargins::m_left
private

Definition at line 72 of file qmargins.h.

Referenced by isNull(), left(), operator!=(), operator==(), QMargins(), and setLeft().

◆ m_right

int QMargins::m_right
private

Definition at line 74 of file qmargins.h.

Referenced by isNull(), operator!=(), operator==(), QMargins(), right(), and setRight().

◆ m_top

int QMargins::m_top
private

Definition at line 73 of file qmargins.h.

Referenced by isNull(), operator!=(), operator==(), QMargins(), setTop(), and top().


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