UsersVM small code style update

This commit is contained in:
Andrew nuark G 2020-12-22 22:31:25 +07:00
parent 9a4b71de36
commit fc9b61467c
2 changed files with 9 additions and 10 deletions

View file

@ -29,29 +29,29 @@ QVariant UsersViewModel::headerData(int section, Qt::Orientation orientation, in
QVariant UsersViewModel::data(const QModelIndex &index, int role) const {
if (role == Qt::DisplayRole) {
auto item = apparatus::instance()->get_auth_subsystem()->users()[index.row()];
int col = index.column();
int col = index.column();
switch (col) {
case 0:
return QString::number(item.id());
case 1:
return item.login();
case 2:
QString role = "unknown";
QString _role = "unknown";
switch(item.role()) {
case UserRole::ADMINISTRATOR:
role = "Administrator";
_role = "Administrator";
break;
case UserRole::DISPATCHER:
role = "Dispatcher";
_role = "Dispatcher";
break;
case UserRole::SKIPPER:
role = "Skipper";
_role = "Skipper";
break;
}
return role;
return _role;
}
return "UNKNOWN FIELD";
@ -61,6 +61,5 @@ QVariant UsersViewModel::data(const QModelIndex &index, int role) const {
}
void UsersViewModel::update() {
this->beginResetModel();
this->endResetModel();
dataChanged(QModelIndex(), QModelIndex());
}