00001 #ifndef UNITMODEL_H 00002 #define UNITMODEL_H 00003 00004 #include "database.h" 00005 00041 class ConvertableUnitModel : public SqlQueryModel { 00042 public: 00043 enum Fields { 00044 UnitToId = Qt::UserRole + 900, 00045 UnitToSymbol, 00046 UnitFromId, 00047 UnitFromSymbol 00048 }; 00049 00050 enum ConstraintKind { //moet eenduiding een sens_id specifieren!! 00051 ConstraintKindTreeId 00052 }; 00053 00054 ConvertableUnitModel(QObject *parent = 0); 00055 QVariant data(const QModelIndex &index, int role) const; 00056 QVariant currentConstraintUnitId() const; 00057 void setConstraint(const int &id, const ConvertableUnitModel::ConstraintKind &kind, 00058 const bool &constrainUnitTo = true, const bool &showUnitFrom = true, 00059 const bool &calibrationUnit = false); 00060 void unconstrain(); 00061 bool isUnitToConstrained(); 00062 bool isUnitFromConstrained(); 00063 00064 private: 00065 QString defaultQuery; 00066 bool constrained; 00067 bool constrainedUnitTo; 00068 }; 00069 00070 #endif // UNITMODEL_H