diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-10-26 14:42:52 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-10-28 15:27:37 +0100 |
commit | 07ff70a0da189656daf31c2a5e3e3ba117762af3 (patch) | |
tree | cc633b36727f4d166112a250733a44026997b090 /src/corelib | |
parent | 29c113d912fdf96f99503c9635bf89c4cabcc6fb (diff) |
Remove QItemSelectionRange's operator<()
As advocated in a ### Qt 6 comment.
[ChangeLog][QtCore][QItemSelectionRange] QItemSelectionRange no longer
supports ordering. The prior ordering was inconsistent with equality
and should not be needed.
Task-number: QTBUG-85700
Change-Id: I5eb372c203cae19db40fa67f706d911785652d5f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/itemmodels/qitemselectionmodel.cpp | 41 | ||||
-rw-r--r-- | src/corelib/itemmodels/qitemselectionmodel.h | 3 |
2 files changed, 0 insertions, 44 deletions
diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp index a47d760e97..b6a6bff118 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.cpp +++ b/src/corelib/itemmodels/qitemselectionmodel.cpp @@ -260,47 +260,6 @@ QItemSelectionRange QItemSelectionRange::intersected(const QItemSelectionRange & */ -#if QT_DEPRECATED_SINCE(5, 15) -/*! - Returns \c true if the selection range is less than the \a other - range given; otherwise returns \c false. - - The less than calculation is not directly useful to developers - the way that ranges - with different parents compare is not defined. This operator only exists so that the - class can be used with QMap. - -*/ -bool QItemSelectionRange::operator<(const QItemSelectionRange &other) const -{ - // ### Qt 6: This is inconsistent with op== and needs to be fixed, nay, - // ### removed, but cannot, because it was inline up to and including 5.9 - - // Comparing parents will compare the models, but if two equivalent ranges - // in two different models have invalid parents, they would appear the same - if (other.tl.model() == tl.model()) { - // parent has to be calculated, so we only do so once. - const QModelIndex topLeftParent = tl.parent(); - const QModelIndex otherTopLeftParent = other.tl.parent(); - if (topLeftParent == otherTopLeftParent) { - if (other.tl.row() == tl.row()) { - if (other.tl.column() == tl.column()) { - if (other.br.row() == br.row()) { - return br.column() < other.br.column(); - } - return br.row() < other.br.row(); - } - return tl.column() < other.tl.column(); - } - return tl.row() < other.tl.row(); - } - return topLeftParent < otherTopLeftParent; - } - - std::less<const QAbstractItemModel *> less; - return less(tl.model(), other.tl.model()); -} -#endif - /*! \fn bool QItemSelectionRange::isValid() const diff --git a/src/corelib/itemmodels/qitemselectionmodel.h b/src/corelib/itemmodels/qitemselectionmodel.h index f2545bf93c..488999937d 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.h +++ b/src/corelib/itemmodels/qitemselectionmodel.h @@ -98,9 +98,6 @@ public: { return (tl == other.tl && br == other.br); } inline bool operator!=(const QItemSelectionRange &other) const { return !operator==(other); } -#if QT_DEPRECATED_SINCE(5, 15) - QT_DEPRECATED bool operator<(const QItemSelectionRange &other) const; -#endif inline bool isValid() const { |