Qt 4.8
Functions
qsize.cpp File Reference
#include "qsize.h"
#include "qdatastream.h"
#include "qdebug.h"

Go to the source code of this file.

Functions

QDataStreamoperator<< (QDataStream &s, const QSize &sz)
 
QDebug operator<< (QDebug dbg, const QSize &s)
 
QDataStreamoperator<< (QDataStream &s, const QSizeF &sz)
 
QDebug operator<< (QDebug dbg, const QSizeF &s)
 
QDataStreamoperator>> (QDataStream &s, QSize &sz)
 
QDataStreamoperator>> (QDataStream &s, QSizeF &sz)
 

Function Documentation

◆ operator<<() [1/4]

QDataStream& operator<< ( QDataStream s,
const QSize sz 
)
related

Definition at line 461 of file qsize.cpp.

462 {
463  if (s.version() == 1)
464  s << (qint16)sz.width() << (qint16)sz.height();
465  else
466  s << (qint32)sz.width() << (qint32)sz.height();
467  return s;
468 }
int qint32
Definition: qglobal.h:937
int width() const
Returns the width.
Definition: qsize.h:126
short qint16
Definition: qglobal.h:935
int version() const
Returns the version number of the data serialization format.
Definition: qdatastream.h:212
int height() const
Returns the height.
Definition: qsize.h:129

◆ operator<<() [2/4]

QDebug operator<< ( QDebug  dbg,
const QSize s 
)

Definition at line 500 of file qsize.cpp.

500  {
501  dbg.nospace() << "QSize(" << s.width() << ", " << s.height() << ')';
502  return dbg.space();
503 }
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
int width() const
Returns the width.
Definition: qsize.h:126
int height() const
Returns the height.
Definition: qsize.h:129
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91

◆ operator<<() [3/4]

QDataStream& operator<< ( QDataStream s,
const QSizeF sz 
)
related

Definition at line 953 of file qsize.cpp.

954 {
955  s << double(sz.width()) << double(sz.height());
956  return s;
957 }
qreal width() const
Returns the width.
Definition: qsize.h:284
qreal height() const
Returns the height.
Definition: qsize.h:287

◆ operator<<() [4/4]

QDebug operator<< ( QDebug  dbg,
const QSizeF s 
)

Definition at line 984 of file qsize.cpp.

984  {
985  dbg.nospace() << "QSizeF(" << s.width() << ", " << s.height() << ')';
986  return dbg.space();
987 }
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
qreal width() const
Returns the width.
Definition: qsize.h:284
qreal height() const
Returns the height.
Definition: qsize.h:287
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91

◆ operator>>() [1/2]

QDataStream& operator>> ( QDataStream s,
QSize sz 
)
related

Definition at line 483 of file qsize.cpp.

484 {
485  if (s.version() == 1) {
486  qint16 w, h;
487  s >> w; sz.rwidth() = w;
488  s >> h; sz.rheight() = h;
489  }
490  else {
491  qint32 w, h;
492  s >> w; sz.rwidth() = w;
493  s >> h; sz.rheight() = h;
494  }
495  return s;
496 }
int qint32
Definition: qglobal.h:937
short qint16
Definition: qglobal.h:935
int version() const
Returns the version number of the data serialization format.
Definition: qdatastream.h:212
int & rheight()
Returns a reference to the height.
Definition: qsize.h:144
int & rwidth()
Returns a reference to the width.
Definition: qsize.h:141

◆ operator>>() [2/2]

QDataStream& operator>> ( QDataStream s,
QSizeF sz 
)
related

Definition at line 972 of file qsize.cpp.

973 {
974  double w, h;
975  s >> w;
976  s >> h;
977  sz.setWidth(qreal(w));
978  sz.setHeight(qreal(h));
979  return s;
980 }
double qreal
Definition: qglobal.h:1193
void setWidth(qreal w)
Sets the width to the given width.
Definition: qsize.h:290
void setHeight(qreal h)
Sets the height to the given height.
Definition: qsize.h:293