summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-04-27 16:40:55 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-29 13:06:39 -0700
commit4f0fd86d3530cf921e63e8a462946a8dfccff5ae (patch)
treecf11ed9628f13448721ebd3ddd465b40dd368a31 /qt-models
parentef769055900fbb391de7e2dbb89f8ffb23c237b0 (diff)
downloadsubsurface-4f0fd86d3530cf921e63e8a462946a8dfccff5ae.tar.gz
Cleanup: remove biggerString() functions
The TankInfoModel and WeightInfoModel had biggerString() functions to determine the correct column widths for the tank- and weight-type columns. The users were removed around 2013. Remove these functions and the corresponding member variable. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/tankinfomodel.cpp15
-rw-r--r--qt-models/tankinfomodel.h2
-rw-r--r--qt-models/weightsysteminfomodel.cpp22
-rw-r--r--qt-models/weightsysteminfomodel.h1
4 files changed, 10 insertions, 30 deletions
diff --git a/qt-models/tankinfomodel.cpp b/qt-models/tankinfomodel.cpp
index 0a54cd305..e91aa4d69 100644
--- a/qt-models/tankinfomodel.cpp
+++ b/qt-models/tankinfomodel.cpp
@@ -10,11 +10,6 @@ TankInfoModel *TankInfoModel::instance()
return &self;
}
-const QString &TankInfoModel::biggerString() const
-{
- return biggerEntry;
-}
-
bool TankInfoModel::insertRows(int, int count, const QModelIndex &parent)
{
beginInsertRows(parent, rowCount(), rowCount());
@@ -91,11 +86,8 @@ TankInfoModel::TankInfoModel() : rows(-1)
{
setHeaderDataStrings(QStringList() << tr("Description") << tr("ml") << tr("bar"));
struct tank_info_t *info = tank_info;
- for (info = tank_info; info->name && info < tank_info + MAX_TANK_INFO; info++, rows++) {
- QString infoName = gettextFromC::tr(info->name);
- if (infoName.count() > biggerEntry.count())
- biggerEntry = infoName;
- }
+ for (info = tank_info; info->name && info < tank_info + MAX_TANK_INFO; info++, rows++)
+ ;
if (rows > -1) {
beginInsertRows(QModelIndex(), 0, rows);
@@ -111,7 +103,8 @@ void TankInfoModel::update()
rows = -1;
}
struct tank_info_t *info = tank_info;
- for (info = tank_info; info->name && info < tank_info + MAX_TANK_INFO; info++, rows++);
+ for (info = tank_info; info->name && info < tank_info + MAX_TANK_INFO; info++, rows++)
+ ;
if (rows > -1) {
beginInsertRows(QModelIndex(), 0, rows);
diff --git a/qt-models/tankinfomodel.h b/qt-models/tankinfomodel.h
index 7f79a466b..0317b054b 100644
--- a/qt-models/tankinfomodel.h
+++ b/qt-models/tankinfomodel.h
@@ -22,7 +22,6 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
- const QString &biggerString() const;
void clear();
public
slots:
@@ -30,7 +29,6 @@ slots:
private:
int rows;
- QString biggerEntry;
};
#endif
diff --git a/qt-models/weightsysteminfomodel.cpp b/qt-models/weightsysteminfomodel.cpp
index f8d2905cf..58cc0ba47 100644
--- a/qt-models/weightsysteminfomodel.cpp
+++ b/qt-models/weightsysteminfomodel.cpp
@@ -71,20 +71,12 @@ int WSInfoModel::rowCount(const QModelIndex&) const
return rows + 1;
}
-const QString &WSInfoModel::biggerString() const
-{
- return biggerEntry;
-}
-
WSInfoModel::WSInfoModel() : rows(-1)
{
setHeaderDataStrings(QStringList() << tr("Description") << tr("kg"));
struct ws_info_t *info;
- for (info = ws_info; info->name && info < ws_info + MAX_WS_INFO; info++, rows++) {
- QString wsInfoName = gettextFromC::tr(info->name);
- if (wsInfoName.count() > biggerEntry.count())
- biggerEntry = wsInfoName;
- }
+ for (info = ws_info; info->name && info < ws_info + MAX_WS_INFO; info++, rows++)
+ ;
if (rows > -1) {
beginInsertRows(QModelIndex(), 0, rows);
@@ -98,11 +90,8 @@ void WSInfoModel::updateInfo()
beginRemoveRows(QModelIndex(), 0, this->rows);
endRemoveRows();
rows = -1;
- for (info = ws_info; info->name && info < ws_info + MAX_WS_INFO; info++, rows++) {
- QString wsInfoName = gettextFromC::tr(info->name);
- if (wsInfoName.count() > biggerEntry.count())
- biggerEntry = wsInfoName;
- }
+ for (info = ws_info; info->name && info < ws_info + MAX_WS_INFO; info++, rows++)
+ ;
if (rows > -1) {
beginInsertRows(QModelIndex(), 0, rows);
@@ -118,7 +107,8 @@ void WSInfoModel::update()
rows = -1;
}
struct ws_info_t *info;
- for (info = ws_info; info->name && info < ws_info + MAX_WS_INFO; info++, rows++);
+ for (info = ws_info; info->name && info < ws_info + MAX_WS_INFO; info++, rows++)
+ ;
if (rows > -1) {
beginInsertRows(QModelIndex(), 0, rows);
diff --git a/qt-models/weightsysteminfomodel.h b/qt-models/weightsysteminfomodel.h
index e94225f8f..6aeb59262 100644
--- a/qt-models/weightsysteminfomodel.h
+++ b/qt-models/weightsysteminfomodel.h
@@ -20,7 +20,6 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
- const QString &biggerString() const;
void clear();
void update();
void updateInfo();