diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/itemmodels/qitemselectionmodel.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp index 59a10e9057..9af4fd9133 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.cpp +++ b/src/corelib/itemmodels/qitemselectionmodel.cpp @@ -218,13 +218,15 @@ QT_BEGIN_NAMESPACE */ bool QItemSelectionRange::intersects(const QItemSelectionRange &other) const { - return (isValid() && other.isValid() - && parent() == other.parent() - && model() == other.model() + // isValid() and parent() last since they are more expensive + return (model() == other.model() && ((top() <= other.top() && bottom() >= other.top()) || (top() >= other.top() && top() <= other.bottom())) && ((left() <= other.left() && right() >= other.left()) - || (left() >= other.left() && left() <= other.right()))); + || (left() >= other.left() && left() <= other.right())) + && parent() == other.parent() + && isValid() && other.isValid() + ); } /*! |