mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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 <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
5e446fd258
commit
1a933e7e19
4 changed files with 10 additions and 9 deletions
|
@ -1323,9 +1323,9 @@ DivePlannerPointsModel::Mode DivePlannerPointsModel::currentMode() const
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QPair<int, int> > DivePlannerPointsModel::collectGases(struct dive *d)
|
QVector<QPair<int, int> > DivePlannerPointsModel::collectGases(struct dive *d)
|
||||||
{
|
{
|
||||||
QList<QPair<int, int> > l;
|
QVector<QPair<int, int> > l;
|
||||||
for (int i = 0; i < MAX_CYLINDERS; i++) {
|
for (int i = 0; i < MAX_CYLINDERS; i++) {
|
||||||
cylinder_t *cyl = &d->cylinder[i];
|
cylinder_t *cyl = &d->cylinder[i];
|
||||||
if (!cylinder_nodata(cyl))
|
if (!cylinder_nodata(cyl))
|
||||||
|
@ -1357,10 +1357,10 @@ void DivePlannerPointsModel::tanksUpdated()
|
||||||
// "did a gas change on us". So we look through the diveplan to
|
// "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
|
// see if there is a gas that is now missing and if there is, we
|
||||||
// replace it with the matching new gas.
|
// replace it with the matching new gas.
|
||||||
QList<QPair<int,int> > gases = collectGases(stagingDive);
|
QVector<QPair<int,int> > gases = collectGases(stagingDive);
|
||||||
if (gases.length() == oldGases.length()) {
|
if (gases.count() == oldGases.count()) {
|
||||||
// either nothing relevant changed, or exactly ONE gasmix changed
|
// 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 (gases.at(i) != oldGases.at(i)) {
|
||||||
if (oldGases.count(oldGases.at(i)) > 1) {
|
if (oldGases.count(oldGases.at(i)) > 1) {
|
||||||
// we had this gas more than once, so don't
|
// we had this gas more than once, so don't
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
int size();
|
int size();
|
||||||
struct diveplan getDiveplan();
|
struct diveplan getDiveplan();
|
||||||
QStringList &getGasList();
|
QStringList &getGasList();
|
||||||
QList<QPair<int, int> > collectGases(dive *d);
|
QVector<QPair<int, int> > collectGases(dive *d);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
int addStop(int millimeters = 0, int seconds = 0, int o2 = 0, int he = 0, int ccpoint = 0 );
|
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);
|
void deleteTemporaryPlan(struct divedatapoint *dp);
|
||||||
QVector<sample> backupSamples; // For editing added dives.
|
QVector<sample> backupSamples; // For editing added dives.
|
||||||
struct dive *stagingDive;
|
struct dive *stagingDive;
|
||||||
QList<QPair<int, int> > oldGases;
|
QVector<QPair<int, int> > oldGases;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Button : public QObject, public QGraphicsRectItem {
|
class Button : public QObject, public QGraphicsRectItem {
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPrinter>
|
#include <QPrinter>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
class QTableView;
|
class QTableView;
|
||||||
class PrintDialog;
|
class PrintDialog;
|
||||||
|
@ -27,7 +28,7 @@ private:
|
||||||
qreal scaleX, scaleY;
|
qreal scaleX, scaleY;
|
||||||
QRect pageRect;
|
QRect pageRect;
|
||||||
|
|
||||||
QList<QString> tablePrintColumnNames;
|
QVector<QString> tablePrintColumnNames;
|
||||||
unsigned int tablePrintHeadingBackground;
|
unsigned int tablePrintHeadingBackground;
|
||||||
QList<unsigned int> tablePrintColumnWidths;
|
QList<unsigned int> tablePrintColumnWidths;
|
||||||
unsigned int profilePrintTableMaxH;
|
unsigned int profilePrintTableMaxH;
|
||||||
|
|
|
@ -45,7 +45,7 @@ public slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef QPair<QGraphicsPixmapItem*, QGraphicsSimpleTextItem*> ToolTip;
|
typedef QPair<QGraphicsPixmapItem*, QGraphicsSimpleTextItem*> ToolTip;
|
||||||
QList<ToolTip> toolTips;
|
QVector<ToolTip> toolTips;
|
||||||
QGraphicsPathItem *background;
|
QGraphicsPathItem *background;
|
||||||
QGraphicsLineItem *separator;
|
QGraphicsLineItem *separator;
|
||||||
QGraphicsSimpleTextItem *title;
|
QGraphicsSimpleTextItem *title;
|
||||||
|
|
Loading…
Add table
Reference in a new issue