diff options
author | Ritt Konstantin <ritt.ks@gmail.com> | 2009-06-08 08:42:42 (GMT) |
---|---|---|
committer | Marius Storm-Olsen <marius@trolltech.com> | 2009-06-08 08:43:01 (GMT) |
commit | eb8789ba06949974eb4108b115a30f96e1500a81 (patch) | |
tree | 523aa4541353053454fb3fd307aee4a742653827 /src/gui | |
parent | ac30cbdceac428fa206a939e5d820b2bd77227fc (diff) | |
download | Qt-eb8789ba06949974eb4108b115a30f96e1500a81.zip Qt-eb8789ba06949974eb4108b115a30f96e1500a81.tar.gz Qt-eb8789ba06949974eb4108b115a30f96e1500a81.tar.bz2 |
Fix QT_NO_DATASTREAM macro checks and improve readability
Some checks where in the wrong locations, and some endifs where
hard to read.
Merge-request: 611
Reviewed-by: Marius Storm-Olsen <marius@trolltech.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/embedded/qkbd_qws_p.h | 3 | ||||
-rw-r--r-- | src/gui/image/qimage.cpp | 2 | ||||
-rw-r--r-- | src/gui/image/qpicture.cpp | 2 | ||||
-rw-r--r-- | src/gui/image/qpicture.h | 2 | ||||
-rw-r--r-- | src/gui/image/qpixmap.cpp | 2 | ||||
-rw-r--r-- | src/gui/itemviews/qheaderview.cpp | 10 | ||||
-rw-r--r-- | src/gui/itemviews/qlistwidget.cpp | 3 | ||||
-rw-r--r-- | src/gui/itemviews/qstandarditemmodel.cpp | 2 | ||||
-rw-r--r-- | src/gui/itemviews/qtreewidget.cpp | 3 | ||||
-rw-r--r-- | src/gui/kernel/qlayout.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qpalette.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qsizepolicy.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qcolor.cpp | 4 | ||||
-rw-r--r-- | src/gui/painting/qfixed_p.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qmatrix.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qpainterpath.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qpolygon.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qtransform.h | 2 | ||||
-rw-r--r-- | src/gui/text/qtextformat.cpp | 4 | ||||
-rw-r--r-- | src/gui/text/qtextformat.h | 4 |
20 files changed, 41 insertions, 20 deletions
diff --git a/src/gui/embedded/qkbd_qws_p.h b/src/gui/embedded/qkbd_qws_p.h index 3224da2..2ef1d0c 100644 --- a/src/gui/embedded/qkbd_qws_p.h +++ b/src/gui/embedded/qkbd_qws_p.h @@ -105,6 +105,7 @@ namespace QWSKeyboard { }; }; +#ifndef QT_NO_DATASTREAM inline QDataStream &operator>>(QDataStream &ds, QWSKeyboard::Mapping &m) { return ds >> m.keycode >> m.unicode >> m.qtcode >> m.modifiers >> m.flags >> m.special; @@ -124,6 +125,6 @@ inline QDataStream &operator<<(QDataStream &ds, const QWSKeyboard::Composing &c) { return ds << c.first << c.second << c.result; } - +#endif // QT_NO_DATASTREAM #endif // QWSKEYBOARD_H diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index c1c5631..0377ca7 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4763,7 +4763,7 @@ QDataStream &operator>>(QDataStream &s, QImage &image) image = QImageReader(s.device(), 0).read(); return s; } -#endif +#endif // QT_NO_DATASTREAM #ifdef QT3_SUPPORT diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index 92023e0..23baa96 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -1143,6 +1143,7 @@ QPaintEngine *QPicture::paintEngine() const QPicture stream functions *****************************************************************************/ +#ifndef QT_NO_DATASTREAM /*! \relates QPicture @@ -1188,6 +1189,7 @@ QDataStream &operator>>(QDataStream &s, QPicture &r) r.d_func()->resetFormat(); return s; } +#endif // QT_NO_DATASTREAM #ifndef QT_NO_PICTUREIO diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h index fe86e8d..edfac71 100644 --- a/src/gui/image/qpicture.h +++ b/src/gui/image/qpicture.h @@ -184,8 +184,10 @@ private: QPicture stream functions *****************************************************************************/ +#ifndef QT_NO_DATASTREAM Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPicture &); Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPicture &); +#endif #endif // QT_NO_PICTURE diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 8ed9e93..f6b5de2 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1317,7 +1317,7 @@ QDataStream &operator>>(QDataStream &stream, QPixmap &pixmap) return stream; } -#endif //QT_NO_DATASTREAM +#endif // QT_NO_DATASTREAM #ifdef QT3_SUPPORT Q_GUI_EXPORT void copyBlt(QPixmap *dst, int dx, int dy, diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index ad93922..d28c08a 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -62,9 +62,11 @@ #ifndef QT_NO_DATASTREAM #include <qdatastream.h> +#endif QT_BEGIN_NAMESPACE +#ifndef QT_NO_DATASTREAM QDataStream &operator<<(QDataStream &out, const QHeaderViewPrivate::SectionSpan &span) { span.write(out); @@ -76,7 +78,7 @@ QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionSpan &span) span.read(in); return in; } -#endif +#endif // QT_NO_DATASTREAM /*! @@ -1535,7 +1537,7 @@ bool QHeaderView::restoreState(const QByteArray &state) } return false; } -#endif +#endif // QT_NO_DATASTREAM /*! \reimp @@ -3571,9 +3573,9 @@ bool QHeaderViewPrivate::read(QDataStream &in) return true; } -QT_END_NAMESPACE +#endif // QT_NO_DATASTREAM -#endif // QT_NO_DATASTREAEM +QT_END_NAMESPACE #endif // QT_NO_ITEMVIEWS diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp index bf3b43c..e1e509d 100644 --- a/src/gui/itemviews/qlistwidget.cpp +++ b/src/gui/itemviews/qlistwidget.cpp @@ -711,6 +711,7 @@ void QListWidgetItem::write(QDataStream &out) const { out << d->values; } +#endif // QT_NO_DATASTREAM /*! \since 4.1 @@ -745,6 +746,8 @@ QListWidgetItem &QListWidgetItem::operator=(const QListWidgetItem &other) return *this; } +#ifndef QT_NO_DATASTREAM + /*! \relates QListWidgetItem diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/gui/itemviews/qstandarditemmodel.cpp index 10aac9a..d8adbd2 100644 --- a/src/gui/itemviews/qstandarditemmodel.cpp +++ b/src/gui/itemviews/qstandarditemmodel.cpp @@ -1938,7 +1938,7 @@ QDataStream &operator<<(QDataStream &out, const QStandardItem &item) return out; } -#endif // !QT_NO_DATASTREAM +#endif // QT_NO_DATASTREAM /*! \class QStandardItemModel diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp index 6103225..a2bfe45 100644 --- a/src/gui/itemviews/qtreewidget.cpp +++ b/src/gui/itemviews/qtreewidget.cpp @@ -1827,6 +1827,7 @@ void QTreeWidgetItem::write(QDataStream &out) const { out << values << d->display; } +#endif // QT_NO_DATASTREAM /*! \since 4.1 @@ -1863,8 +1864,6 @@ QTreeWidgetItem &QTreeWidgetItem::operator=(const QTreeWidgetItem &other) return *this; } -#endif // QT_NO_DATASTREAM - /*! Appends the \a child item to the list of children. diff --git a/src/gui/kernel/qlayout.cpp b/src/gui/kernel/qlayout.cpp index 4463aab..0a233d5 100644 --- a/src/gui/kernel/qlayout.cpp +++ b/src/gui/kernel/qlayout.cpp @@ -1583,8 +1583,6 @@ QDataStream &operator>>(QDataStream &stream, QSizePolicy &policy) { return stream >> policy.data; } - -#endif - +#endif // QT_NO_DATASTREAM QT_END_NAMESPACE diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index 6541510..18a2142 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -125,7 +125,7 @@ QDataStream &operator>>(QDataStream &s, QColorGroup &g) { return qt_stream_in_qcolorgroup(s, g); } -#endif +#endif // QT_NO_DATASTREAM /*! Constructs a palette with the specified \a active, \a disabled and @@ -158,7 +158,7 @@ void QPalette::setColorGroup(ColorGroup cg, const QColorGroup &g) g.brush(LinkVisited), g.brush(ToolTipBase), g.brush(ToolTipText)); } -#endif +#endif // QT3_SUPPORT /*! \fn const QColor &QPalette::color(ColorRole role) const diff --git a/src/gui/kernel/qsizepolicy.h b/src/gui/kernel/qsizepolicy.h index 652fda1..32b3b4f 100644 --- a/src/gui/kernel/qsizepolicy.h +++ b/src/gui/kernel/qsizepolicy.h @@ -203,9 +203,11 @@ private: Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes) +#ifndef QT_NO_DATASTREAM // implemented in qlayout.cpp Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &); Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &); +#endif inline void QSizePolicy::transpose() { Policy hData = horizontalPolicy(); diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index b1fe3aa..fa833db 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -2116,9 +2116,7 @@ QDataStream &operator>>(QDataStream &stream, QColor &color) return stream; } -#endif - - +#endif // QT_NO_DATASTREAM /***************************************************************************** diff --git a/src/gui/painting/qfixed_p.h b/src/gui/painting/qfixed_p.h index 2e49615..c89d97a 100644 --- a/src/gui/painting/qfixed_p.h +++ b/src/gui/painting/qfixed_p.h @@ -181,8 +181,10 @@ inline bool operator<(int i, const QFixed &f) { return (i<<6) < f.value(); } inline bool operator>(const QFixed &f, int i) { return f.value() > (i<<6); } inline bool operator>(int i, const QFixed &f) { return (i<<6) > f.value(); } +#ifndef QT_NO_DEBUG_STREAM inline QDebug &operator<<(QDebug &dbg, const QFixed &f) { return dbg << f.toReal(); } +#endif struct QFixedPoint { QFixed x; diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h index 1e5fbb4..1df2395 100644 --- a/src/gui/painting/qmatrix.h +++ b/src/gui/painting/qmatrix.h @@ -169,8 +169,10 @@ inline bool QMatrix::isIdentity() const QMatrix stream functions *****************************************************************************/ +#ifndef QT_NO_DATASTREAM Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QMatrix &); Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QMatrix &); +#endif #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QMatrix &); diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index bd91dfc..e1bb317 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -2366,7 +2366,7 @@ QDataStream &operator>>(QDataStream &s, QPainterPath &p) p.d_func()->dirtyControlBounds = true; return s; } -#endif +#endif // QT_NO_DATASTREAM /******************************************************************************* diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp index 769c095..b79c288 100644 --- a/src/gui/painting/qpolygon.cpp +++ b/src/gui/painting/qpolygon.cpp @@ -742,7 +742,7 @@ QDataStream &operator>>(QDataStream &s, QPolygon &a) QVector<QPoint> &v = a; return s >> v; } -#endif +#endif // QT_NO_DATASTREAM /***************************************************************************** QPolygonF stream functions diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index aac7c31..a5002ca 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -332,8 +332,10 @@ inline QTransform &QTransform::operator-=(qreal num) } /****** stream functions *******************/ +#ifndef QT_NO_DATASTREAM Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTransform &); Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTransform &); +#endif #ifndef QT_NO_DEBUG_STREAM Q_GUI_EXPORT QDebug operator<<(QDebug, const QTransform &); diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 38ac4ca..d93f084 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -142,6 +142,7 @@ QTextLength::operator QVariant() const return QVariant(QVariant::TextLength, this); } +#ifndef QT_NO_DATASTREAM QDataStream &operator<<(QDataStream &stream, const QTextLength &length) { return stream << qint32(length.lengthType) << double(length.fixedValueOrPercentage); @@ -156,6 +157,7 @@ QDataStream &operator>>(QDataStream &stream, QTextLength &length) length.lengthType = QTextLength::Type(type); return stream; } +#endif // QT_NO_DATASTREAM class QTextFormatPrivate : public QSharedData { @@ -374,6 +376,7 @@ void QTextFormatPrivate::recalcFont() const fontDirty = false; } +#ifndef QT_NO_DATASTREAM Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QTextFormat &fmt) { stream << fmt.format_type << fmt.properties(); @@ -396,6 +399,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt) return stream; } +#endif // QT_NO_DATASTREAM /*! \class QTextFormat diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h index 8eaeeb1..96c0739 100644 --- a/src/gui/text/qtextformat.h +++ b/src/gui/text/qtextformat.h @@ -76,8 +76,10 @@ class QTextCursor; class QTextDocument; class QTextLength; +#ifndef QT_NO_DATASTREAM Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextLength &); Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextLength &); +#endif class Q_GUI_EXPORT QTextLength { @@ -119,8 +121,10 @@ private: inline QTextLength::QTextLength(Type atype, qreal avalue) : lengthType(atype), fixedValueOrPercentage(avalue) {} +#ifndef QT_NO_DATASTREAM Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextFormat &); Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextFormat &); +#endif class Q_GUI_EXPORT QTextFormat { |