not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / ksplash / ksplashx / qrect.cpp
blobf05881de1c86f7f99ba63693943d3bf150400cb8
1 /****************************************************************************
2 **
3 ** This file is based on sources of the Qt GUI Toolkit, used under the terms
4 ** of the GNU General Public License version 2 (see the original copyright
5 ** notice below).
6 ** All further contributions to this file are (and are required to be)
7 ** licensed under the terms of the GNU General Public License as published by
8 ** the Free Software Foundation; either version 2 of the License, or
9 ** (at your option) any later version.
11 ** The original Qt license header follows:
12 **
14 ** Implementation of QRect class
16 ** Created : 931028
18 ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
20 ** This file is part of the kernel module of the Qt GUI Toolkit.
22 ** This file may be distributed under the terms of the Q Public License
23 ** as defined by Trolltech AS of Norway and appearing in the file
24 ** LICENSE.QPL included in the packaging of this file.
26 ** This file may be distributed and/or modified under the terms of the
27 ** GNU General Public License version 2 as published by the Free Software
28 ** Foundation and appearing in the file LICENSE.GPL included in the
29 ** packaging of this file.
31 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
32 ** licenses may use this file in accordance with the Qt Commercial License
33 ** Agreement provided with the Software.
35 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
36 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
38 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
39 ** information about Qt Commercial License Agreements.
40 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
41 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
43 ** Contact info@trolltech.com if any conditions of this licensing are
44 ** not clear to you.
46 **********************************************************************/
48 #define QRECT_C
49 #include "qrect.h"
50 #include "qdatastream.h"
52 /*!
53 \class QRect
54 \brief The QRect class defines a rectangle in the plane.
56 \ingroup images
57 \ingroup graphics
58 \mainclass
60 A rectangle is internally represented as an upper-left corner and
61 a bottom-right corner, but it is normally expressed as an
62 upper-left corner and a size.
64 The coordinate type is QCOORD (defined in \c qwindowdefs.h as \c
65 int). The minimum value of QCOORD is QCOORD_MIN (-2147483648) and
66 the maximum value is QCOORD_MAX (2147483647).
68 Note that the size (width and height) of a rectangle might be
69 different from what you are used to. If the top-left corner and
70 the bottom-right corner are the same, the height and the width of
71 the rectangle will both be 1.
73 Generally, \e{width = right - left + 1} and \e{height = bottom -
74 top + 1}. We designed it this way to make it correspond to
75 rectangular spaces used by drawing functions in which the width
76 and height denote a number of pixels. For example, drawing a
77 rectangle with width and height 1 draws a single pixel.
79 The default coordinate system has origin (0, 0) in the top-left
80 corner. The positive direction of the y axis is down, and the
81 positive x axis is from left to right.
83 A QRect can be constructed with a set of left, top, width and
84 height integers, from two QPoints or from a QPoint and a QSize.
85 After creation the dimensions can be changed, e.g. with setLeft(),
86 setRight(), setTop() and setBottom(), or by setting sizes, e.g.
87 setWidth(), setHeight() and setSize(). The dimensions can also be
88 changed with the move functions, e.g. moveBy(), moveCenter(),
89 moveBottomRight(), etc. You can also add coordinates to a
90 rectangle with addCoords().
92 You can test to see if a QRect contains a specific point with
93 contains(). You can also test to see if two QRects intersect with
94 intersects() (see also intersect()). To get the bounding rectangle
95 of two QRects use unite().
97 \sa QPoint, QSize
101 /*****************************************************************************
102 QRect member functions
103 *****************************************************************************/
106 \fn QRect::QRect()
108 Constructs an invalid rectangle.
112 Constructs a rectangle with \a topLeft as the top-left corner and
113 \a bottomRight as the bottom-right corner.
116 QRect::QRect( const QPoint &topLeft, const QPoint &bottomRight )
118 x1 = (QCOORD)topLeft.x();
119 y1 = (QCOORD)topLeft.y();
120 x2 = (QCOORD)bottomRight.x();
121 y2 = (QCOORD)bottomRight.y();
125 Constructs a rectangle with \a topLeft as the top-left corner and
126 \a size as the rectangle size.
129 QRect::QRect( const QPoint &topLeft, const QSize &size )
131 x1 = (QCOORD)topLeft.x();
132 y1 = (QCOORD)topLeft.y();
133 x2 = (QCOORD)(x1+size.width()-1);
134 y2 = (QCOORD)(y1+size.height()-1);
138 \fn QRect::QRect( int left, int top, int width, int height )
140 Constructs a rectangle with the \a top, \a left corner and \a
141 width and \a height.
143 Example (creates three identical rectangles):
144 \code
145 QRect r1( QPoint(100,200), QPoint(110,215) );
146 QRect r2( QPoint(100,200), QSize(11,16) );
147 QRect r3( 100, 200, 11, 16 );
148 \endcode
153 \fn bool QRect::isNull() const
155 Returns TRUE if the rectangle is a null rectangle; otherwise
156 returns FALSE.
158 A null rectangle has both the width and the height set to 0, that
159 is right() == left() - 1 and bottom() == top() - 1.
161 Note that if right() == left() and bottom() == top(), then the
162 rectangle has width 1 and height 1.
164 A null rectangle is also empty.
166 A null rectangle is not valid.
168 \sa isEmpty(), isValid()
172 \fn bool QRect::isEmpty() const
174 Returns TRUE if the rectangle is empty; otherwise returns FALSE.
176 An empty rectangle has a left() \> right() or top() \> bottom().
178 An empty rectangle is not valid. \c{isEmpty() == !isValid()}
180 \sa isNull(), isValid(), normalize()
184 \fn bool QRect::isValid() const
186 Returns TRUE if the rectangle is valid; otherwise returns FALSE.
188 A valid rectangle has a left() \<= right() and top() \<= bottom().
190 Note that non-trivial operations like intersections are not defined
191 for invalid rectangles.
193 \c{isValid() == !isEmpty()}
195 \sa isNull(), isEmpty(), normalize()
200 Returns a normalized rectangle, i.e. a rectangle that has a
201 non-negative width and height.
203 It swaps left and right if left() \> right(), and swaps top and
204 bottom if top() \> bottom().
206 \sa isValid()
209 QRect QRect::normalize() const
211 QRect r;
212 if ( x2 < x1 ) { // swap bad x values
213 r.x1 = x2;
214 r.x2 = x1;
215 } else {
216 r.x1 = x1;
217 r.x2 = x2;
219 if ( y2 < y1 ) { // swap bad y values
220 r.y1 = y2;
221 r.y2 = y1;
222 } else {
223 r.y1 = y1;
224 r.y2 = y2;
226 return r;
231 \fn int QRect::left() const
233 Returns the left coordinate of the rectangle. Identical to x().
235 \sa setLeft(), right(), topLeft(), bottomLeft()
239 \fn int QRect::top() const
241 Returns the top coordinate of the rectangle. Identical to y().
243 \sa setTop(), bottom(), topLeft(), topRight()
247 \fn int QRect::right() const
249 Returns the right coordinate of the rectangle.
251 \sa setRight(), left(), topRight(), bottomRight()
255 \fn int QRect::bottom() const
257 Returns the bottom coordinate of the rectangle.
259 \sa setBottom(), top(), bottomLeft(), bottomRight()
263 \fn QCOORD &QRect::rLeft()
265 Returns a reference to the left coordinate of the rectangle.
267 \sa rTop(), rRight(), rBottom()
271 \fn QCOORD &QRect::rTop()
273 Returns a reference to the top coordinate of the rectangle.
275 \sa rLeft(), rRight(), rBottom()
279 \fn QCOORD &QRect::rRight()
281 Returns a reference to the right coordinate of the rectangle.
283 \sa rLeft(), rTop(), rBottom()
287 \fn QCOORD &QRect::rBottom()
289 Returns a reference to the bottom coordinate of the rectangle.
291 \sa rLeft(), rTop(), rRight()
295 \fn int QRect::x() const
297 Returns the left coordinate of the rectangle. Identical to left().
299 \sa left(), y(), setX()
303 \fn int QRect::y() const
305 Returns the top coordinate of the rectangle. Identical to top().
307 \sa top(), x(), setY()
311 \fn void QRect::setLeft( int pos )
313 Sets the left edge of the rectangle to \a pos. May change the
314 width, but will never change the right edge of the rectangle.
316 Identical to setX().
318 \sa left(), setTop(), setWidth()
322 \fn void QRect::setTop( int pos )
324 Sets the top edge of the rectangle to \a pos. May change the
325 height, but will never change the bottom edge of the rectangle.
327 Identical to setY().
329 \sa top(), setBottom(), setHeight()
333 \fn void QRect::setRight( int pos )
335 Sets the right edge of the rectangle to \a pos. May change the
336 width, but will never change the left edge of the rectangle.
338 \sa right(), setLeft(), setWidth()
342 \fn void QRect::setBottom( int pos )
344 Sets the bottom edge of the rectangle to \a pos. May change the
345 height, but will never change the top edge of the rectangle.
347 \sa bottom(), setTop(), setHeight()
351 \fn void QRect::setX( int x )
353 Sets the x position of the rectangle (its left end) to \a x. May
354 change the width, but will never change the right edge of the
355 rectangle.
357 Identical to setLeft().
359 \sa x(), setY()
363 \fn void QRect::setY( int y )
365 Sets the y position of the rectangle (its top) to \a y. May change
366 the height, but will never change the bottom edge of the
367 rectangle.
369 Identical to setTop().
371 \sa y(), setX()
375 Set the top-left corner of the rectangle to \a p. May change
376 the size, but will the never change the bottom-right corner of
377 the rectangle.
379 \sa topLeft(), moveTopLeft(), setBottomRight(), setTopRight(), setBottomLeft()
381 void QRect::setTopLeft( const QPoint &p )
383 setLeft( p.x() );
384 setTop( p.y() );
388 Set the bottom-right corner of the rectangle to \a p. May change
389 the size, but will the never change the top-left corner of
390 the rectangle.
392 \sa bottomRight(), moveBottomRight(), setTopLeft(), setTopRight(), setBottomLeft()
394 void QRect::setBottomRight( const QPoint &p )
396 setRight( p.x() );
397 setBottom( p.y() );
401 Set the top-right corner of the rectangle to \a p. May change
402 the size, but will the never change the bottom-left corner of
403 the rectangle.
405 \sa topRight(), moveTopRight(), setTopLeft(), setBottomRight(), setBottomLeft()
407 void QRect::setTopRight( const QPoint &p )
409 setRight( p.x() );
410 setTop( p.y() );
414 Set the bottom-left corner of the rectangle to \a p. May change
415 the size, but will the never change the top-right corner of
416 the rectangle.
418 \sa bottomLeft(), moveBottomLeft(), setTopLeft(), setBottomRight(), setTopRight()
420 void QRect::setBottomLeft( const QPoint &p )
422 setLeft( p.x() );
423 setBottom( p.y() );
427 \fn QPoint QRect::topLeft() const
429 Returns the top-left position of the rectangle.
431 \sa setTopLeft(), moveTopLeft(), bottomRight(), left(), top()
435 \fn QPoint QRect::bottomRight() const
437 Returns the bottom-right position of the rectangle.
439 \sa setBottomRight(), moveBottomRight(), topLeft(), right(), bottom()
443 \fn QPoint QRect::topRight() const
445 Returns the top-right position of the rectangle.
447 \sa setTopRight(), moveTopRight(), bottomLeft(), top(), right()
451 \fn QPoint QRect::bottomLeft() const
453 Returns the bottom-left position of the rectangle.
455 \sa setBottomLeft(), moveBottomLeft(), topRight(), bottom(), left()
459 \fn QPoint QRect::center() const
461 Returns the center point of the rectangle.
463 \sa moveCenter(), topLeft(), bottomRight(), topRight(), bottomLeft()
468 Extracts the rectangle parameters as the position \a *x, \a *y and
469 width \a *w and height \a *h.
471 \sa setRect(), coords()
474 void QRect::rect( int *x, int *y, int *w, int *h ) const
476 *x = x1;
477 *y = y1;
478 *w = x2-x1+1;
479 *h = y2-y1+1;
483 Extracts the rectangle parameters as the top-left point \a *xp1,
484 \a *yp1 and the bottom-right point \a *xp2, \a *yp2.
486 \sa setCoords(), rect()
489 void QRect::coords( int *xp1, int *yp1, int *xp2, int *yp2 ) const
491 *xp1 = x1;
492 *yp1 = y1;
493 *xp2 = x2;
494 *yp2 = y2;
499 Sets the left position of the rectangle to \a pos, leaving the
500 size unchanged.
502 \sa left(), setLeft(), moveTop(), moveRight(), moveBottom()
504 void QRect::moveLeft( int pos )
506 x2 += (QCOORD)(pos - x1);
507 x1 = (QCOORD)pos;
511 Sets the top position of the rectangle to \a pos, leaving the
512 size unchanged.
514 \sa top(), setTop(), moveLeft(), moveRight(), moveBottom()
517 void QRect::moveTop( int pos )
519 y2 += (QCOORD)(pos - y1);
520 y1 = (QCOORD)pos;
524 Sets the right position of the rectangle to \a pos, leaving the
525 size unchanged.
527 \sa right(), setRight(), moveLeft(), moveTop(), moveBottom()
530 void QRect::moveRight( int pos )
532 x1 += (QCOORD)(pos - x2);
533 x2 = (QCOORD)pos;
537 Sets the bottom position of the rectangle to \a pos, leaving the
538 size unchanged.
540 \sa bottom(), setBottom(), moveLeft(), moveTop(), moveRight()
543 void QRect::moveBottom( int pos )
545 y1 += (QCOORD)(pos - y2);
546 y2 = (QCOORD)pos;
550 Sets the top-left position of the rectangle to \a p, leaving the
551 size unchanged.
553 \sa topLeft(), setTopLeft(), moveBottomRight(), moveTopRight(), moveBottomLeft()
556 void QRect::moveTopLeft( const QPoint &p )
558 moveLeft( p.x() );
559 moveTop( p.y() );
563 Sets the bottom-right position of the rectangle to \a p, leaving
564 the size unchanged.
566 \sa bottomRight(), setBottomRight(), moveTopLeft(), moveTopRight(), moveBottomLeft()
569 void QRect::moveBottomRight( const QPoint &p )
571 moveRight( p.x() );
572 moveBottom( p.y() );
576 Sets the top-right position of the rectangle to \a p, leaving the
577 size unchanged.
579 \sa topRight(), setTopRight(), moveTopLeft(), moveBottomRight(), moveBottomLeft()
582 void QRect::moveTopRight( const QPoint &p )
584 moveRight( p.x() );
585 moveTop( p.y() );
589 Sets the bottom-left position of the rectangle to \a p, leaving
590 the size unchanged.
592 \sa bottomLeft(), setBottomLeft(), moveTopLeft(), moveBottomRight(), moveTopRight()
595 void QRect::moveBottomLeft( const QPoint &p )
597 moveLeft( p.x() );
598 moveBottom( p.y() );
603 Sets the center point of the rectangle to \a p, leaving the size
604 unchanged.
606 \sa center(), moveTopLeft(), moveBottomRight(), moveTopRight(), moveBottomLeft()
609 void QRect::moveCenter( const QPoint &p )
611 QCOORD w = x2 - x1;
612 QCOORD h = y2 - y1;
613 x1 = (QCOORD)(p.x() - w/2);
614 y1 = (QCOORD)(p.y() - h/2);
615 x2 = x1 + w;
616 y2 = y1 + h;
621 Moves the rectangle \a dx along the x axis and \a dy along the y
622 axis, relative to the current position. Positive values move the
623 rectangle to the right and down.
625 \sa moveTopLeft()
628 void QRect::moveBy( int dx, int dy )
630 x1 += (QCOORD)dx;
631 y1 += (QCOORD)dy;
632 x2 += (QCOORD)dx;
633 y2 += (QCOORD)dy;
637 Sets the coordinates of the rectangle's top-left corner to \a (x,
638 y), and its size to \a (w, h).
640 \sa rect(), setCoords()
643 void QRect::setRect( int x, int y, int w, int h )
645 x1 = (QCOORD)x;
646 y1 = (QCOORD)y;
647 x2 = (QCOORD)(x+w-1);
648 y2 = (QCOORD)(y+h-1);
652 Sets the coordinates of the rectangle's top-left corner to \a
653 (xp1, yp1), and the coordinates of its bottom-right corner to \a
654 (xp2, yp2).
656 \sa coords(), setRect()
659 void QRect::setCoords( int xp1, int yp1, int xp2, int yp2 )
661 x1 = (QCOORD)xp1;
662 y1 = (QCOORD)yp1;
663 x2 = (QCOORD)xp2;
664 y2 = (QCOORD)yp2;
668 Adds \a xp1, \a yp1, \a xp2 and \a yp2 respectively to the
669 existing coordinates of the rectangle.
672 void QRect::addCoords( int xp1, int yp1, int xp2, int yp2 )
674 x1 += (QCOORD)xp1;
675 y1 += (QCOORD)yp1;
676 x2 += (QCOORD)xp2;
677 y2 += (QCOORD)yp2;
681 \fn QSize QRect::size() const
683 Returns the size of the rectangle.
685 \sa width(), height()
689 \fn int QRect::width() const
691 Returns the width of the rectangle. The width includes both the
692 left and right edges, i.e. width = right - left + 1.
694 \sa height(), size(), setHeight()
698 \fn int QRect::height() const
700 Returns the height of the rectangle. The height includes both the
701 top and bottom edges, i.e. height = bottom - top + 1.
703 \sa width(), size(), setHeight()
707 Sets the width of the rectangle to \a w. The right edge is
708 changed, but not the left edge.
710 \sa width(), setLeft(), setRight(), setSize()
713 void QRect::setWidth( int w )
715 x2 = (QCOORD)(x1 + w - 1);
719 Sets the height of the rectangle to \a h. The top edge is not
720 moved, but the bottom edge may be moved.
722 \sa height(), setTop(), setBottom(), setSize()
725 void QRect::setHeight( int h )
727 y2 = (QCOORD)(y1 + h - 1);
731 Sets the size of the rectangle to \a s. The top-left corner is not
732 moved.
734 \sa size(), setWidth(), setHeight()
737 void QRect::setSize( const QSize &s )
739 x2 = (QCOORD)(s.width() +x1-1);
740 y2 = (QCOORD)(s.height()+y1-1);
744 Returns TRUE if the point \a p is inside or on the edge of the
745 rectangle; otherwise returns FALSE.
747 If \a proper is TRUE, this function returns TRUE only if \a p is
748 inside (not on the edge).
751 bool QRect::contains( const QPoint &p, bool proper ) const
753 if ( proper )
754 return p.x() > x1 && p.x() < x2 &&
755 p.y() > y1 && p.y() < y2;
756 else
757 return p.x() >= x1 && p.x() <= x2 &&
758 p.y() >= y1 && p.y() <= y2;
762 \overload bool QRect::contains( int x, int y, bool proper ) const
764 Returns TRUE if the point \a x, \a y is inside this rectangle;
765 otherwise returns FALSE.
767 If \a proper is TRUE, this function returns TRUE only if the point
768 is entirely inside (not on the edge).
772 \overload bool QRect::contains( int x, int y ) const
774 Returns TRUE if the point \a x, \a y is inside this rectangle;
775 otherwise returns FALSE.
779 \overload
781 Returns TRUE if the rectangle \a r is inside this rectangle;
782 otherwise returns FALSE.
784 If \a proper is TRUE, this function returns TRUE only if \a r is
785 entirely inside (not on the edge).
787 \sa unite(), intersect(), intersects()
790 bool QRect::contains( const QRect &r, bool proper ) const
792 if ( proper )
793 return r.x1 > x1 && r.x2 < x2 && r.y1 > y1 && r.y2 < y2;
794 else
795 return r.x1 >= x1 && r.x2 <= x2 && r.y1 >= y1 && r.y2 <= y2;
799 Unites this rectangle with rectangle \a r.
801 QRect& QRect::operator|=(const QRect &r)
803 *this = *this | r;
804 return *this;
808 Intersects this rectangle with rectangle \a r.
810 QRect& QRect::operator&=(const QRect &r)
812 *this = *this & r;
813 return *this;
818 Returns the bounding rectangle of this rectangle and rectangle \a
821 The bounding rectangle of a nonempty rectangle and an empty or
822 invalid rectangle is defined to be the nonempty rectangle.
824 \sa operator|=(), operator&(), intersects(), contains()
827 QRect QRect::operator|(const QRect &r) const
829 if ( isValid() ) {
830 if ( r.isValid() ) {
831 QRect tmp;
832 tmp.setLeft( qMin( x1, r.x1 ) );
833 tmp.setRight( qMax( x2, r.x2 ) );
834 tmp.setTop( qMin( y1, r.y1 ) );
835 tmp.setBottom( qMax( y2, r.y2 ) );
836 return tmp;
837 } else {
838 return *this;
840 } else {
841 return r;
846 Returns the bounding rectangle of this rectangle and rectangle \a
847 r. \c{r.unite(s)} is equivalent to \c{r|s}.
849 QRect QRect::unite( const QRect &r ) const
851 return *this | r;
856 Returns the intersection of this rectangle and rectangle \a r.
858 Returns an empty rectangle if there is no intersection.
860 \sa operator&=(), operator|(), isEmpty(), intersects(), contains()
863 QRect QRect::operator&( const QRect &r ) const
865 QRect tmp;
866 tmp.x1 = qMax( x1, r.x1 );
867 tmp.x2 = qMin( x2, r.x2 );
868 tmp.y1 = qMax( y1, r.y1 );
869 tmp.y2 = qMin( y2, r.y2 );
870 return tmp;
874 Returns the intersection of this rectangle and rectangle \a r.
875 \c{r.intersect(s)} is equivalent to \c{r&s}.
877 QRect QRect::intersect( const QRect &r ) const
879 return *this & r;
883 Returns TRUE if this rectangle intersects with rectangle \a r
884 (there is at least one pixel that is within both rectangles);
885 otherwise returns FALSE.
887 \sa intersect(), contains()
890 bool QRect::intersects( const QRect &r ) const
892 return ( qMax( x1, r.x1 ) <= qMin( x2, r.x2 ) &&
893 qMax( y1, r.y1 ) <= qMin( y2, r.y2 ) );
898 \relates QRect
900 Returns TRUE if \a r1 and \a r2 are equal; otherwise returns FALSE.
903 bool operator==( const QRect &r1, const QRect &r2 )
905 return r1.x1==r2.x1 && r1.x2==r2.x2 && r1.y1==r2.y1 && r1.y2==r2.y2;
909 \relates QRect
911 Returns TRUE if \a r1 and \a r2 are different; otherwise returns FALSE.
914 bool operator!=( const QRect &r1, const QRect &r2 )
916 return r1.x1!=r2.x1 || r1.x2!=r2.x2 || r1.y1!=r2.y1 || r1.y2!=r2.y2;
920 /*****************************************************************************
921 QRect stream functions
922 *****************************************************************************/
923 #ifndef QT_NO_DATASTREAM
925 \relates QRect
927 Writes the QRect, \a r, to the stream \a s, and returns a
928 reference to the stream.
930 \sa \link datastreamformat.html Format of the QDataStream operators \endlink
933 QDataStream &operator<<( QDataStream &s, const QRect &r )
935 if ( s.version() == 1 )
936 s << (Q_INT16)r.left() << (Q_INT16)r.top()
937 << (Q_INT16)r.right() << (Q_INT16)r.bottom();
938 else
939 s << (Q_INT32)r.left() << (Q_INT32)r.top()
940 << (Q_INT32)r.right() << (Q_INT32)r.bottom();
941 return s;
945 \relates QRect
947 Reads a QRect from the stream \a s into rect \a r and returns a
948 reference to the stream.
950 \sa \link datastreamformat.html Format of the QDataStream operators \endlink
953 QDataStream &operator>>( QDataStream &s, QRect &r )
955 if ( s.version() == 1 ) {
956 Q_INT16 x1, y1, x2, y2;
957 s >> x1; s >> y1; s >> x2; s >> y2;
958 r.setCoords( x1, y1, x2, y2 );
960 else {
961 Q_INT32 x1, y1, x2, y2;
962 s >> x1; s >> y1; s >> x2; s >> y2;
963 r.setCoords( x1, y1, x2, y2 );
965 return s;
967 #endif // QT_NO_DATASTREAM