|
|
@ -83,6 +83,10 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
return Qt::AlignLeft;
|
|
|
|
return Qt::AlignLeft;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (role == Qt::EditRole)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return dispData;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return QVariant::Invalid;
|
|
|
|
return QVariant::Invalid;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -208,6 +212,22 @@ private:
|
|
|
|
QList<QSharedPointer<T> > m_fullList;
|
|
|
|
QList<QSharedPointer<T> > m_fullList;
|
|
|
|
bool filtered;
|
|
|
|
bool filtered;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// QAbstractItemModel interface
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
virtual bool setData(const QModelIndex &index, const QVariant &value, int role) override
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (role == Qt::EditRole)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
QSharedPointer<T> entity = m_list.at(index.row());
|
|
|
|
|
|
|
|
QObject *rawEntity = (QObject*)entity.data();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rawEntity->setProperty(rawEntity->metaObject()->property(index.column() + 1).name(), value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
emit editCompleted();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // ODBTABLEMODEL_H
|
|
|
|
#endif // ODBTABLEMODEL_H
|
|
|
|