QSize Class Reference

QSize Class Reference

#include <qsize.h>

Class Description

Definition at line 53 of file qsize.h.

Public Member Functions

 QSize ()
 
 QSize (int w, int h)
 
bool isNull () const
 
bool isEmpty () const
 
bool isValid () const
 
int width () const
 
int height () const
 
void setWidth (int w)
 
void setHeight (int h)
 
void transpose ()
 
void scale (int w, int h, Qt::AspectRatioMode mode)
 
void scale (const QSize &s, Qt::AspectRatioMode mode)
 
QSize expandedTo (const QSize &) const
 
QSize boundedTo (const QSize &) const
 
intrwidth ()
 
intrheight ()
 
QSizeoperator+= (const QSize &)
 
QSizeoperator-= (const QSize &)
 
QSizeoperator*= (qreal c)
 
QSizeoperator/= (qreal c)
 

Friends

bool operator== (const QSize &, const QSize &)
 
bool operator!= (const QSize &, const QSize &)
 
const QSize operator+ (const QSize &, const QSize &)
 
const QSize operator- (const QSize &, const QSize &)
 
const QSize operator* (const QSize &, qreal)
 
const QSize operator* (qreal, const QSize &)
 
const QSize operator/ (const QSize &, qreal)
 

Constructor & Destructor Documentation

QSize ( )
inline

Definition at line 111 of file qsize.h.

112 { wd = ht = -1; }
QSize ( int  w,
int  h 
)
inline

Definition at line 114 of file qsize.h.

115 { wd = w; ht = h; }
int int int int int int h
Definition: GLee.h:10534
GLubyte GLubyte GLubyte GLubyte w
Definition: GLee.h:1775

Member Function Documentation

bool isNull ( ) const
inline

Definition at line 117 of file qsize.h.

118 { return wd==0 && ht==0; }
bool isEmpty ( ) const
inline

Definition at line 120 of file qsize.h.

121 { return wd<1 || ht<1; }
bool isValid ( ) const
inline

Definition at line 123 of file qsize.h.

124 { return wd>=0 && ht>=0; }
int width ( ) const
inline
+ Examples:

Definition at line 126 of file qsize.h.

127 { return wd; }
int height ( ) const
inline
+ Examples:

Definition at line 129 of file qsize.h.

130 { return ht; }
void setWidth ( int  w)
inline

Definition at line 132 of file qsize.h.

133 { wd = w; }
GLubyte GLubyte GLubyte GLubyte w
Definition: GLee.h:1775
void setHeight ( int  h)
inline

Definition at line 135 of file qsize.h.

136 { ht = h; }
int int int int int int h
Definition: GLee.h:10534
void scale ( int  w,
int  h,
Qt::AspectRatioMode  mode 
)
inline

Definition at line 138 of file qsize.h.

139 { scale(QSize(w, h), mode); }
GLint mode
Definition: GLee.h:4479
QSize()
Definition: qsize.h:111
int int int int int int h
Definition: GLee.h:10534
void scale(int w, int h, Qt::AspectRatioMode mode)
Definition: qsize.h:138
GLubyte GLubyte GLubyte GLubyte w
Definition: GLee.h:1775
void scale ( const QSize s,
Qt::AspectRatioMode  mode 
)
QSize expandedTo ( const QSize otherSize) const
inline

Definition at line 187 of file qsize.h.

188 {
189  return QSize(qMax(wd,otherSize.wd), qMax(ht,otherSize.ht));
190 }
QSize()
Definition: qsize.h:111
QSize boundedTo ( const QSize otherSize) const
inline

Definition at line 192 of file qsize.h.

193 {
194  return QSize(qMin(wd,otherSize.wd), qMin(ht,otherSize.ht));
195 }
QSize()
Definition: qsize.h:111
int & rwidth ( )
inline

Definition at line 141 of file qsize.h.

142 { return wd; }
int & rheight ( )
inline

Definition at line 144 of file qsize.h.

145 { return ht; }
QSize & operator+= ( const QSize s)
inline

Definition at line 147 of file qsize.h.

148 { wd+=s.wd; ht+=s.ht; return *this; }
QSize & operator-= ( const QSize s)
inline

Definition at line 150 of file qsize.h.

151 { wd-=s.wd; ht-=s.ht; return *this; }
QSize & operator*= ( qreal  c)
inline

Definition at line 153 of file qsize.h.

154 { wd = qRound(wd*c); ht = qRound(ht*c); return *this; }
const GLubyte * c
Definition: GLee.h:5419
QSize & operator/= ( qreal  c)
inline

Definition at line 174 of file qsize.h.

175 {
176  Q_ASSERT(!qFuzzyIsNull(c));
177  wd = qRound(wd/c); ht = qRound(ht/c);
178  return *this;
179 }
const GLubyte * c
Definition: GLee.h:5419

Friends And Related Function Documentation

bool operator== ( const QSize s1,
const QSize s2 
)
friend

Definition at line 156 of file qsize.h.

157 { return s1.wd == s2.wd && s1.ht == s2.ht; }
bool operator!= ( const QSize s1,
const QSize s2 
)
friend

Definition at line 159 of file qsize.h.

160 { return s1.wd != s2.wd || s1.ht != s2.ht; }
const QSize operator+ ( const QSize s1,
const QSize s2 
)
friend

Definition at line 162 of file qsize.h.

163 { return QSize(s1.wd+s2.wd, s1.ht+s2.ht); }
QSize()
Definition: qsize.h:111
const QSize operator- ( const QSize s1,
const QSize s2 
)
friend

Definition at line 165 of file qsize.h.

166 { return QSize(s1.wd-s2.wd, s1.ht-s2.ht); }
QSize()
Definition: qsize.h:111
const QSize operator* ( const QSize s,
qreal  c 
)
friend

Definition at line 168 of file qsize.h.

169 { return QSize(qRound(s.wd*c), qRound(s.ht*c)); }
QSize()
Definition: qsize.h:111
const GLubyte * c
Definition: GLee.h:5419
const QSize operator* ( qreal  c,
const QSize s 
)
friend

Definition at line 171 of file qsize.h.

172 { return QSize(qRound(s.wd*c), qRound(s.ht*c)); }
QSize()
Definition: qsize.h:111
const GLubyte * c
Definition: GLee.h:5419
const QSize operator/ ( const QSize s,
qreal  c 
)
friend

Definition at line 181 of file qsize.h.

182 {
183  Q_ASSERT(!qFuzzyIsNull(c));
184  return QSize(qRound(s.wd/c), qRound(s.ht/c));
185 }
QSize()
Definition: qsize.h:111
const GLubyte * c
Definition: GLee.h:5419

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