Editor for privileges. More...
#include <projecteditor.h>
Public Member Functions | |
PrivilegeEditor (QWidget *parent=0) | |
SqlTableModel * | model () const |
void | hideColumn (const QString &columnName) |
void | hideColumn (int column) |
void | select () |
Editor for privileges.
PrivilegeEditor::PrivilegeEditor | ( | QWidget * | parent = 0 |
) | [inline] |
: QTableView(parent) { setWindowTitle("Privilege Editor"); // model setup SqlTableModel *privModel = new SqlTableModel(this, Database::staticCon()); privModel->setEditStrategy(QSqlTableModel::OnFieldChange); privModel->setTable("vew_project_privileges"); setModel(privModel); // model header setup (no need to call model()->select() for this as the model has allready fetched the field-data) privModel->setHeaderData(privModel->record().indexOf("rls_user_name"), Qt::Horizontal, "user", Qt::DisplayRole); privModel->setHeaderData(privModel->record().indexOf("proj_name"), Qt::Horizontal, "project", Qt::DisplayRole); QString ownerToolTip("<body>Shows whether the user is the owner of (i.e. has made the) the project or not. Owners have full access to the project they own. They can also grant privileges to others for the projects they own.</body>"); QString readToolTip("<body>Shows whether the user can see the project and it's dependencies: the setup and sensor data.</body>"); QString writeToolTip("<body>Shows whether the user can adjust the projectdependant data: the project record, setup?, add data?</body>"); QString deleteToolTip("<body>Shows whether the user can delete projectdependant data, such as the setup, the sensor data, but also the project itself? = miss best alleen de owner?</body>"); privModel->setHeaderData(privModel->record().indexOf("owner"), Qt::Horizontal, ownerToolTip, Qt::ToolTipRole); privModel->setHeaderData(privModel->record().indexOf("read"), Qt::Horizontal, readToolTip, Qt::ToolTipRole); privModel->setHeaderData(privModel->record().indexOf("write"), Qt::Horizontal, writeToolTip, Qt::ToolTipRole); privModel->setHeaderData(privModel->record().indexOf("delete"), Qt::Horizontal, deleteToolTip, Qt::ToolTipRole); }
void PrivilegeEditor::hideColumn | ( | const QString & | columnName | ) | [inline] |
Referenced by hideColumn(), ProjectEditor::ProjectEditor(), and UserEditor::UserEditor().
{ hideColumn(model()->record().indexOf(columnName)); }
void PrivilegeEditor::hideColumn | ( | int | column | ) | [inline] |
Reimplemented from QTableView.
{ QTableView::hideColumn(column); }
SqlTableModel* PrivilegeEditor::model | ( | ) | const [inline] |
Referenced by hideColumn(), and select().
{ Q_ASSERT(QTableView::model()); SqlTableModel *m = dynamic_cast<SqlTableModel*>(QTableView::model()); Q_ASSERT(m); return m; }
void PrivilegeEditor::select | ( | ) | [inline] |
Referenced by ProjectEditor::ProjectEditor(), and UserEditor::UserEditor().