Changeset 561 for trunk/src/corelib/tools/qrect.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/corelib/tools/qrect.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the QtCore module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 51 51 /*! 52 52 \class QRect 53 \ingroup multimedia53 \ingroup 54 54 55 55 \brief The QRect class defines a rectangle in the plane using … … 902 902 \fn bool QRect::contains(const QPoint &point, bool proper) const 903 903 904 Returns true if the thegiven \a point is inside or on the edge of904 Returns true if the given \a point is inside or on the edge of 905 905 the rectangle, otherwise returns false. If \a proper is true, this 906 906 function only returns true if the given \a point is \e inside the … … 1325 1325 /*! 1326 1326 \class QRectF 1327 \ingroup multimedia1327 \ingroup 1328 1328 1329 1329 \brief The QRectF class defines a rectangle in the plane using floating … … 2155 2155 QRectF QRectF::operator|(const QRectF &r) const 2156 2156 { 2157 qreal l1 = xp; 2158 qreal r1 = xp; 2157 if (isNull()) 2158 return r; 2159 if (r.isNull()) 2160 return *this; 2161 2162 qreal left = xp; 2163 qreal right = xp; 2159 2164 if (w < 0) 2160 l1 += w; 2161 else 2162 r1 += w; 2163 if (l1 == r1) // null rect 2164 return r; 2165 2166 qreal l2 = r.xp; 2167 qreal r2 = r.xp; 2168 if (r.w < 0) 2169 l2 += r.w; 2170 else 2171 r2 += r.w; 2172 if (l2 == r2) // null rect 2173 return *this; 2174 2175 qreal t1 = yp; 2176 qreal b1 = yp; 2165 left += w; 2166 else 2167 right += w; 2168 2169 if (r.w < 0) { 2170 left = qMin(left, r.xp + r.w); 2171 right = qMax(right, r.xp); 2172 } else { 2173 left = qMin(left, r.xp); 2174 right = qMax(right, r.xp + r.w); 2175 } 2176 2177 qreal top = yp; 2178 qreal bottom = yp; 2177 2179 if (h < 0) 2178 t1 += h; 2179 else 2180 b1 += h; 2181 if (t1 == b1) // null rect 2182 return r; 2183 2184 qreal t2 = r.yp; 2185 qreal b2 = r.yp; 2186 if (r.h < 0) 2187 t2 += r.h; 2188 else 2189 b2 += r.h; 2190 if (t2 == b2) // null rect 2191 return *this; 2192 2193 QRectF tmp; 2194 tmp.xp = qMin(l1, l2); 2195 tmp.yp = qMin(t1, t2); 2196 tmp.w = qMax(r1, r2) - tmp.xp; 2197 tmp.h = qMax(b1, b2) - tmp.yp; 2198 return tmp; 2180 top += h; 2181 else 2182 bottom += h; 2183 2184 if (r.h < 0) { 2185 top = qMin(top, r.yp + r.h); 2186 bottom = qMax(bottom, r.yp); 2187 } else { 2188 top = qMin(top, r.yp); 2189 bottom = qMax(bottom, r.yp + r.h); 2190 } 2191 2192 return QRectF(left, top, right - left, bottom - top); 2199 2193 } 2200 2194
Note:
See TracChangeset
for help on using the changeset viewer.