\o The number of items (quint32)
\o For all items, the key (Key) and value (T)
\endlist
+ \row \o QMargins
+ \o \list
+ \o left (int)
+ \o top (int)
+ \o right (int)
+ \o bottom (int)
+ \endlist
\row \o QMatrix
\o \list
\o m11 (double)
Returns true if \a m1 and \a m2 are different; otherwise returns false.
*/
+/*****************************************************************************
+ QMargins stream functions
+ *****************************************************************************/
+#ifndef QT_NO_DATASTREAM
+/*!
+ \fn QDataStream &operator<<(QDataStream &stream, const QMargins &m)
+ \relates QMargins
+
+ Writes the given \a margin to the given \a stream and returns a
+ reference to the stream.
+
+ \sa {Serializing Qt Data Types}
+*/
+
+QDataStream &operator<<(QDataStream &s, const QMargins &m)
+{
+ s << m.left() << m.top() << m.right() << m.bottom();
+ return s;
+}
+
+/*!
+ \fn QDataStream &operator>>(QDataStream &stream, QMargins &m)
+ \relates QMargins
+
+ Reads a margin from the given \a stream into the given \a margin
+ and returns a reference to the stream.
+
+ \sa {Serializing Qt Data Types}
+*/
+
+QDataStream &operator>>(QDataStream &s, QMargins &m)
+{
+ int left, top, right, bottom;
+ s >> left; m.setLeft(left);
+ s >> top; m.setTop(top);
+ s >> right; m.setRight(right);
+ s >> bottom; m.setBottom(bottom);
+ return s;
+}
+#endif // QT_NO_DATASTREAM
+
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QMargins &m) {
dbg.nospace() << "QMargins(" << m.left() << ", "
Q_DECLARE_TYPEINFO(QMargins, Q_MOVABLE_TYPE);
/*****************************************************************************
+ QMargins stream functions
+ *****************************************************************************/
+#ifndef QT_NO_DATASTREAM
+Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QMargins &);
+Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QMargins &);
+#endif
+
+/*****************************************************************************
QMargins inline functions
*****************************************************************************/
void cleanup();
private slots:
void getSetCheck();
+ void dataStreamCheck();
};
// Testing get/set functions
QCOMPARE(margins, QMargins(5, 0, 5, 0));
}
+// Testing QDataStream operators
+void tst_QMargins::dataStreamCheck()
+{
+ QByteArray buffer;
+
+ // stream out
+ {
+ QMargins marginsOut(0,INT_MIN,INT_MAX,6852);
+ QDataStream streamOut(&buffer, QIODevice::WriteOnly);
+ streamOut << marginsOut;
+ }
+
+ // stream in & compare
+ {
+ QMargins marginsIn;
+ QDataStream streamIn(&buffer, QIODevice::ReadOnly);
+ streamIn >> marginsIn;
+
+ QCOMPARE(marginsIn.left(), 0);
+ QCOMPARE(marginsIn.top(), INT_MIN);
+ QCOMPARE(marginsIn.right(), INT_MAX);
+ QCOMPARE(marginsIn.bottom(), 6852);
+ }
+}
+
tst_QMargins::tst_QMargins()
{
}