diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-04-30 15:34:08 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-05-14 19:43:10 +0000 |
commit | 68eea0196ebf30617e7d837ac5f61aaeeb814692 (patch) | |
tree | f7c1489c3f4e6d4170a1a9dc15f58d788495ee08 /src/widgets/itemviews/qtableview_p.h | |
parent | b70327923527bd9f10e258ca8fd170d5916b9ae6 (diff) |
QTableView: replace QLinkedList with std::list
The object is never copied, so there's no point in using a cow'ed list implementation.
Apart from the usual API adaptions (isEmpty() -> empty(), append() -> push_back()),
alse replaced two foreach-loops with ranged-for. The first one does not call into
out-of-line functions, and doesn't modify the container it iterates over, so is
safe.
The second does call into out-of-line functions, but they are const. The loop does
not modify the container it iterates over, either, so is also safe (except for some
fishy const_cast somewhere, or const being lost due to shallowness of const).
Also replaced explicit-iterator loops with ranged-for where possible.
Change-Id: I60b0f2d356846d527bfbaa6a0ecbb8395013b852
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/widgets/itemviews/qtableview_p.h')
-rw-r--r-- | src/widgets/itemviews/qtableview_p.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/widgets/itemviews/qtableview_p.h b/src/widgets/itemviews/qtableview_p.h index 7578e4b448..8f174351d2 100644 --- a/src/widgets/itemviews/qtableview_p.h +++ b/src/widgets/itemviews/qtableview_p.h @@ -53,12 +53,13 @@ #include <QtWidgets/private/qtwidgetsglobal_p.h> #include <QtCore/QList> -#include <QtCore/QLinkedList> #include <QtCore/QMap> #include <QtCore/QSet> #include <QtCore/QDebug> #include "private/qabstractitemview_p.h" +#include <list> + QT_REQUIRE_CONFIG(tableview); QT_BEGIN_NAMESPACE @@ -115,7 +116,7 @@ public: bool checkConsistency() const; #endif - typedef QLinkedList<Span *> SpanList; + typedef std::list<Span *> SpanList; SpanList spans; //lists of all spans private: //the indexes are negative so the QMap::lowerBound do what i need. @@ -210,7 +211,7 @@ public: return span(row, column).width(); } inline bool hasSpans() const { - return !spans.spans.isEmpty(); + return !spans.spans.empty(); } inline int rowSpanHeight(int row, int span) const { return sectionSpanSize(verticalHeader, row, span); |