From 66fc9fcfecfd4d9a40a287b66c15d48691a24660 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Thu, 27 Feb 2020 19:07:11 +0100 Subject: 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 --- qt-models/cleanertablemodel.h | 4 ---- qt-models/cylindermodel.cpp | 5 +++-- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'qt-models') 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; -- cgit v1.2.3-70-g09d2