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>
This commit is contained in:
Berthold Stoeger 2020-02-27 19:07:11 +01:00
parent a75360f58f
commit 66fc9fcfec
2 changed files with 3 additions and 6 deletions

View file

@ -31,8 +31,4 @@ private:
QStringList headers;
};
/* Has the string value changed */
#define CHANGED() \
(vString = value.toString()) != data(index, role).toString()
#endif

View file

@ -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;