Changeset 846 for trunk/src/gui/painting/qregion.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/painting/qregion.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 712 712 713 713 /*! 714 \fn bool QRegion::intersects(const QRect &rect) const 714 715 \since 4.2 715 716 … … 717 718 returns false. 718 719 */ 719 bool QRegion::intersects(const QRect &rect) const 720 { 721 if (isEmpty() || rect.isNull()) 722 return false; 723 724 const QRect r = rect.normalized(); 725 if (!rect_intersects(boundingRect(), r)) 726 return false; 727 if (rectCount() == 1) 728 return true; 729 730 const QVector<QRect> myRects = rects(); 731 for (QVector<QRect>::const_iterator it = myRects.constBegin(); it < myRects.constEnd(); ++it) 732 if (rect_intersects(r, *it)) 733 return true; 734 return false; 735 } 720 736 721 737 722 #if !defined (Q_OS_UNIX) && !defined (Q_WS_WIN) && !defined (Q_WS_PM) … … 1726 1711 QT_END_INCLUDE_NAMESPACE 1727 1712 1728 /* 1 if two BOX s overlap.1729 * 0 if two BOX s do not overlap.1713 /* 1 if two BOXes overlap. 1714 * 0 if two BOXes do not overlap. 1730 1715 * Remember, x2 and y2 are not in the region 1731 1716 */ … … 4376 4361 } 4377 4362 4363 bool QRegion::intersects(const QRect &rect) const 4364 { 4365 if (isEmptyHelper(d->qt_rgn) || rect.isNull()) 4366 return false; 4367 4368 const QRect r = rect.normalized(); 4369 if (!rect_intersects(d->qt_rgn->extents, r)) 4370 return false; 4371 if (d->qt_rgn->numRects == 1) 4372 return true; 4373 4374 const QVector<QRect> myRects = rects(); 4375 for (QVector<QRect>::const_iterator it = myRects.constBegin(); it < myRects.constEnd(); ++it) 4376 if (rect_intersects(r, *it)) 4377 return true; 4378 return false; 4379 } 4380 4381 4378 4382 #endif 4379 4383 QT_END_NAMESPACE
Note:
See TracChangeset
for help on using the changeset viewer.