diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-02-27 19:07:11 +0100 |
---|---|---|
committer | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-04-07 00:13:35 +0200 |
commit | 66fc9fcfecfd4d9a40a287b66c15d48691a24660 (patch) | |
tree | 9a1ad625767d4ec948098c3250cdab5bb3baf3b9 | |
parent | a75360f58f60d1cdbf102e58997555f490969144 (diff) | |
download | subsurface-66fc9fcfecfd4d9a40a287b66c15d48691a24660.tar.gz |
CylindersModel: fold CHANGED() macro into setData()
The CHANGED macro was defined in the cleanerTableModel header.
Since it had only one user, expand it there. The macro was very
questionably anyway, as it would set the local "vString" variable.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | qt-models/cleanertablemodel.h | 4 | ||||
-rw-r--r-- | qt-models/cylindermodel.cpp | 5 |
2 files changed, 3 insertions, 6 deletions
diff --git a/qt-models/cleanertablemodel.h b/qt-models/cleanertablemodel.h index 4299e9002..d54deb248 100644 --- a/qt-models/cleanertablemodel.h +++ b/qt-models/cleanertablemodel.h @@ -31,8 +31,4 @@ private: QStringList headers; }; -/* Has the string value changed */ -#define CHANGED() \ - (vString = value.toString()) != data(index, role).toString() - #endif diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp index df8bd179d..62f9118f1 100644 --- a/qt-models/cylindermodel.cpp +++ b/qt-models/cylindermodel.cpp @@ -291,7 +291,6 @@ cylinder_t *CylindersModel::cylinderAt(const QModelIndex &index) bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, int role) { - QString vString; if (!d) return false; @@ -321,7 +320,9 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in return false; } - bool changed = CHANGED(); + QString vString = value.toString(); + bool changed = vString != data(index, role).toString(); + if (index.column() != TYPE && !changed) return false; |