From 1a933e7e19ba3ded1ab508dfb7ef4f19a1da4519 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Tue, 24 Dec 2013 10:18:56 -0200 Subject: Don't use QList if sizeof(item) > void*. QList is optimized for storing pointer-sized items, thus a QVector is the better choice for everything else. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/diveplanner.cpp | 10 +++++----- qt-ui/diveplanner.h | 4 ++-- qt-ui/printlayout.h | 3 ++- qt-ui/profilegraphics.h | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 303327d42..54db1ad7f 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -1323,9 +1323,9 @@ DivePlannerPointsModel::Mode DivePlannerPointsModel::currentMode() const return mode; } -QList > DivePlannerPointsModel::collectGases(struct dive *d) +QVector > DivePlannerPointsModel::collectGases(struct dive *d) { - QList > l; + QVector > l; for (int i = 0; i < MAX_CYLINDERS; i++) { cylinder_t *cyl = &d->cylinder[i]; if (!cylinder_nodata(cyl)) @@ -1357,10 +1357,10 @@ void DivePlannerPointsModel::tanksUpdated() // "did a gas change on us". So we look through the diveplan to // see if there is a gas that is now missing and if there is, we // replace it with the matching new gas. - QList > gases = collectGases(stagingDive); - if (gases.length() == oldGases.length()) { + QVector > gases = collectGases(stagingDive); + if (gases.count() == oldGases.count()) { // either nothing relevant changed, or exactly ONE gasmix changed - for (int i = 0; i < gases.length(); i++) { + for (int i = 0; i < gases.count(); i++) { if (gases.at(i) != oldGases.at(i)) { if (oldGases.count(oldGases.at(i)) > 1) { // we had this gas more than once, so don't diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h index a3c50919c..95dc31fb4 100644 --- a/qt-ui/diveplanner.h +++ b/qt-ui/diveplanner.h @@ -43,7 +43,7 @@ public: int size(); struct diveplan getDiveplan(); QStringList &getGasList(); - QList > collectGases(dive *d); + QVector > collectGases(dive *d); public slots: int addStop(int millimeters = 0, int seconds = 0, int o2 = 0, int he = 0, int ccpoint = 0 ); @@ -76,7 +76,7 @@ private: void deleteTemporaryPlan(struct divedatapoint *dp); QVector backupSamples; // For editing added dives. struct dive *stagingDive; - QList > oldGases; + QVector > oldGases; }; class Button : public QObject, public QGraphicsRectItem { diff --git a/qt-ui/printlayout.h b/qt-ui/printlayout.h index 077d7ac14..e55d23dd1 100644 --- a/qt-ui/printlayout.h +++ b/qt-ui/printlayout.h @@ -4,6 +4,7 @@ #include #include #include +#include class QTableView; class PrintDialog; @@ -27,7 +28,7 @@ private: qreal scaleX, scaleY; QRect pageRect; - QList tablePrintColumnNames; + QVector tablePrintColumnNames; unsigned int tablePrintHeadingBackground; QList tablePrintColumnWidths; unsigned int profilePrintTableMaxH; diff --git a/qt-ui/profilegraphics.h b/qt-ui/profilegraphics.h index c9d1ef2e6..064b4478d 100644 --- a/qt-ui/profilegraphics.h +++ b/qt-ui/profilegraphics.h @@ -45,7 +45,7 @@ public slots: private: typedef QPair ToolTip; - QList toolTips; + QVector toolTips; QGraphicsPathItem *background; QGraphicsLineItem *separator; QGraphicsSimpleTextItem *title; -- cgit v1.2.3-70-g09d2