BPS C++ API  2.24.4
bpsrelationtablemodel.h
Go to the documentation of this file.
1 
4 #ifndef BPSRELATIONTABLEMODEL_H
5 #define BPSRELATIONTABLEMODEL_H
6 
7 #include "bpscore_global.h"
8 #include <QStandardItemModel>
9 
10 class BpsDatastore;
11 
42 {
43  Q_OBJECT
45 
46 public:
50  enum Status {
51  StatusFalse = 0,
52  StatusTrue = 1,
53  StatusEnable = 2,
54  StatusDisable = 3
55  };
56 
57 
84  QObject *aParent,
85  BpsDatastore* aDatastore,
86  const QString& aRelationTable,
87  const QString& aMasterColumn,
88  const QString& aOptionColumn,
89  const QString& aOptionTable,
90  const QString& aOptionKey);
91 
93 
94  virtual ~BpsRelationTableModel();
95 
96  Qt::ItemFlags flags(const QModelIndex &aIndex) const;
97 
99 
105  void setDescriptions(const QMap<QString,QString>& aDescriptions);
106 
111  void clear();
112 
118  void select();
119 
126  void setMaster(qlonglong aMaster);
127 
131  bool isDirty();
132 
137  void submitAll();
138 
142  void revertAll();
143 
148  QStringList checkedOptionNames(qlonglong aMaster) const;
149 
155  void checkOptions(qlonglong aMaster, const QStringList& aList);
156 
162  void setItemsEnabled(bool aEnabled = true);
163 
168 
169 signals:
170 
174  void wasModified();
175 
177 private slots:
178  void enableOption(QStandardItem* aItem);
180 };
181 
182 #endif // BPSRELATIONTABLEMODEL_H
Public include file for BPS CORE library macros.
#define BPSCORE_EXPORT
Declare class to be an import from the shared library.
Definition: bpscore_global.h:22
#define BPS_PRIVATE(Class)
Declare pointer to private object in a public class.
Definition: bpsglobals.h:102
BPS datastore class.
Definition: bpsdatastore.h:61
This class implements a relation table model for option assignments, such as for example t_grouppermi...
Definition: bpsrelationtablemodel.h:42
void setDescriptions(const QMap< QString, QString > &aDescriptions)
Add a second column with descriptions for the option table key.
void clear()
Clears all data from the model.
QString relationTable() const
void revertAll()
Reverts all unsaved changes.
void submitAll()
Submits all unsaved changed to the database.
QStringList checkedOptionNames(qlonglong aMaster) const
void select()
Select the list of all available options.
void checkOptions(qlonglong aMaster, const QStringList &aList)
Sets all options in the list as checked, and all options not in the list as unchecked.
void wasModified()
This signal is emitted whenever a status is changed to StatusEnable or StatusDisable.
Status
Current status of an option.
Definition: bpsrelationtablemodel.h:50
BpsRelationTableModel(QObject *aParent, BpsDatastore *aDatastore, const QString &aRelationTable, const QString &aMasterColumn, const QString &aOptionColumn, const QString &aOptionTable, const QString &aOptionKey)
Constructor for a BpsRelationTableModel.
void setMaster(qlonglong aMaster)
Set the model to the master table item.
void setItemsEnabled(bool aEnabled=true)
Enable/disable the displayed items.
virtual Qt::ItemFlags flags(const QModelIndex &index) const const override
typedef ItemFlags