In my administration window, i list a table (Qtableview) of existing users of the program. And operations for adding, editing or deleting users.
One of the columns in the table is "Password". Currently everyone ho has access to the admin window in my program, has enough rights so i'm not hiding passwords from anyone.
Except, there is one user called "admin" he is the pre-created user who cannot be deleted or modified by others. I want the password field to be invisible (****) for the row where the "admin" is listed. (only if the "admin" is not logged in).
I now you have echomode for QlineEdit, that is good for in the process when inserting a new user or editing. However, i don't know how to pass the echomode with the model?
For example, i have ordinary model wich has:
{
...
if (!index.isValid())
if (role == Qt::DisplayRole)
{
.....
switch(index.column())
{
case 0:
return object.strFirstName;
case 1:
return object.strLastName;
case 2:
return object.strLogin;
case 3:
return object.strPass; // how to set echomode::password (or: *****) ?
}
}
QVariant UsersModel::data(const QModelIndex &index, int role) const
{
...
if (!index.isValid())
return QVariant();
if (role == Qt::DisplayRole)
{
.....
switch(index.column())
{
case 0:
return object.strFirstName;
case 1:
return object.strLastName;
case 2:
return object.strLogin;
case 3:
return object.strPass; // how to set echomode::password (or: *****) ?
}
}
To copy to clipboard, switch view to plain text mode
How can i have echomode in QtableView?
Bookmarks