Go to the documentation of this file.00001
00004 #ifndef BPSRELATIONTABLEMODEL_H
00005 #define BPSRELATIONTABLEMODEL_H
00006
00007 #include "bpscore_global.h"
00008 #include <QStandardItemModel>
00009
00010 class BpsDatastore;
00011
00041 class BPSCORE_EXPORT BpsRelationTableModel : public QStandardItemModel
00042 {
00043 Q_OBJECT
00044 BPS_PRIVATE(BpsRelationTableModel)
00045
00046 public:
00050 enum Status {
00051 StatusFalse = 0,
00052 StatusTrue = 1,
00053 StatusEnable = 2,
00054 StatusDisable = 3
00055 };
00056
00057
00083 BpsRelationTableModel(
00084 QObject *aParent,
00085 BpsDatastore* aDatastore,
00086 const QString& aRelationTable,
00087 const QString& aMasterColumn,
00088 const QString& aOptionColumn,
00089 const QString& aOptionTable,
00090 const QString& aOptionKey);
00091
00093
00094 virtual ~BpsRelationTableModel();
00095
00096 Qt::ItemFlags flags(const QModelIndex &aIndex) const;
00097
00099
00105 void setDescriptions(const QMap<QString,QString>& aDescriptions);
00106
00111 void clear();
00112
00118 void select();
00119
00126 void setMaster(qlonglong aMaster);
00127
00131 bool isDirty();
00132
00137 void submitAll();
00138
00142 void revertAll();
00143
00148 QStringList checkedOptionNames(qlonglong aMaster) const;
00149
00155 void checkOptions(qlonglong aMaster, const QStringList& aList);
00156
00162 void setItemsEnabled(bool aEnabled = true);
00163
00167 QString relationTable() const;
00168
00169 signals:
00170
00174 void wasModified();
00175
00177 private slots:
00178 void enableOption(QStandardItem* aItem);
00180 };
00181
00182 #endif // BPSRELATIONTABLEMODEL_H