Roles can now be declared read-only. First read-only role: IdRole
This commit is contained in:
@ -25,9 +25,12 @@ enum UserRoles {
|
||||
|
||||
static UserRoles DEFAULT_ROLE = NameRole;
|
||||
// TODO ?rename USER_FACING_ROLES -> MAIN_ROLES ?
|
||||
static QList<UserRoles> USER_FACING_ROLES = {NameRole, DescriptionRole, InfoRole,
|
||||
TypeRole, AmountRole, FactorRole};
|
||||
static QHash<int, QByteArray> ROLE_NAMES = {
|
||||
static QList<UserRoles> USER_FACING_ROLES = {NameRole, DescriptionRole, InfoRole, TypeRole,
|
||||
AmountRole, FactorRole, IdRole};
|
||||
|
||||
static QList<UserRoles> READ_ONLY_ROLES = {IdRole};
|
||||
|
||||
static QHash<int, QByteArray> ROLE_NAMES = {
|
||||
{NameRole, "name"}, {DescriptionRole, "description"},
|
||||
{InfoRole, "info"}, {TypeRole, "type"},
|
||||
{AmountRole, "amount"}, {FactorRole, "factor"},
|
||||
@ -71,6 +74,9 @@ static UserRoles GET_ROLE_FOR_COLUMN(const int column) {
|
||||
case 5:
|
||||
return FactorRole;
|
||||
break;
|
||||
case 6:
|
||||
return IdRole;
|
||||
break;
|
||||
default:
|
||||
qWarning() << QString("No role found for column %1! Returning 'NameRole'...").arg(column);
|
||||
return NameRole;
|
||||
|
||||
Reference in New Issue
Block a user