Editor for smartlet users. More...
#include <projecteditor.h>
Public Member Functions | |
UserEditor (QWidget *parent=0) | |
Protected Member Functions | |
virtual void | onCurrentRecordChange (int row) |
Editor for smartlet users.
UserEditor::UserEditor | ( | QWidget * | parent = 0 |
) | [inline] |
: MappedBaseEditor(parent), privView(new PrivilegeEditor(this)) { setObjectName("UserEditor"); setWindowTitle("User editor"); //set source setTable("tbl_users", "user_name", Qt::AscendingOrder); model()->setRowIdentifierField("user_name"); // widget setup QLabel *name = new QLabel("&Name*:", this); QLabel *pwd = new QLabel("&Password:", this); QLabel *priv = new QLabel("Project &rights:", this); QLineEdit *nameEdit = new QLineEdit(this); QLineEdit *pwdEdit = new QLineEdit(this); pwdEdit->setReadOnly(true); name->setBuddy(nameEdit); priv->setBuddy(privView); pwd->setBuddy(pwdEdit); // privilege box QGroupBox *privBox = new QGroupBox("Privileges", this); privBox->setLayout(new QVBoxLayout()); QCheckBox *isAdmin = new QCheckBox("Admin", privBox); QCheckBox *canCreateProjects = new QCheckBox("Create projects", privBox); privBox->layout()->addWidget(isAdmin); privBox->layout()->addWidget(canCreateProjects); dynamic_cast<QBoxLayout*>(privBox->layout())->addStretch(0); // privileges hide columns privView->hideColumn("rls_user_name"); // add widgets addWidget(name, 0, 0, 1, 1); addWidget(nameEdit, 0, 1, 1, 1, "user_name"); addWidget(pwd, 1, 0, 1, 1); addWidget(pwdEdit, 1, 1, 1, 1, "password"); addWidget(priv, 2, 0, 1, 2); addWidget(privView, 3, 0, 1, 2); addWidget(privBox, 0, 3, 4, 1); // add extra widget mappings addWidgetMapping(isAdmin, "isadmin"); addWidgetMapping(canCreateProjects, "cancreateproject"); // setup connections connect(nameEdit, SIGNAL(textChanged(QString)), this, SLOT(updateButtons())); connect(isAdmin, SIGNAL(toggled(bool)), this, SLOT(updateButtons())); connect(canCreateProjects, SIGNAL(toggled(bool)), this, SLOT(updateButtons())); // update changes select(); privView->select(); }
virtual void UserEditor::onCurrentRecordChange | ( | int | row | ) | [inline, protected, virtual] |
Reimplemented from MappedBaseEditor.
{ MappedBaseEditor::onCurrentRecordChange(row); updatePrivilegesView(); }