I do have
TreeView {
id: view
enabled: !settingsData.allDisabled
TableViewColumn {
title: "Icon"
role: "image"
width: 32
delegate: Image {
height: 20
source: "image://icons/" + id
// source: image
}
}
TableViewColumn {
title: "Name"
role: "display"
resizable: true
visible: true
}
TableViewColumn {
TreeView {
id: view
enabled: !settingsData.allDisabled
TableViewColumn {
title: "Icon"
role: "image"
width: 32
delegate: Image {
height: 20
source: "image://icons/" + id
// source: image
}
}
TableViewColumn {
title: "Name"
role: "display"
resizable: true
visible: true
}
TableViewColumn {
To copy to clipboard, switch view to plain text mode
And
QHash<int, QByteArray> PasswordListModel::roleNames() const {
result.insert(ImageRole, QByteArrayLiteral("image"));
result.insert(LastAccessedRole, QByteArrayLiteral("lastAccessed"));
result.insert(LastModifiedRole, QByteArrayLiteral("lastModified"));
result.insert(ContainerIdRole, QByteArrayLiteral("containerId"));
return result;
}
QHash<int, QByteArray> PasswordListModel::roleNames() const {
QHash<int, QByteArray> result = QAbstractItemModel::roleNames();
result.insert(ImageRole, QByteArrayLiteral("image"));
result.insert(LastAccessedRole, QByteArrayLiteral("lastAccessed"));
result.insert(LastModifiedRole, QByteArrayLiteral("lastModified"));
result.insert(ContainerIdRole, QByteArrayLiteral("containerId"));
return result;
}
To copy to clipboard, switch view to plain text mode
and
{
if (!index.isValid())
.
.
.
case ImageRole: {
qDebug () << "ImageRole";
// return QVariant(QString("image://icons/password_icon"));
// return QVariant(QString("password_icon"));
}
QVariant PasswordListModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
.
.
.
case ImageRole: {
qDebug () << "ImageRole";
// return QVariant(QString("image://icons/password_icon"));
// return QVariant(QString("password_icon"));
return QString ("password_icon");
}
To copy to clipboard, switch view to plain text mode
How to ImagaProvider will get notification to return correct bitmap for QML side. Based on my debugging, MyClass::requestPixmap(const QString &id, QSize */*size*/, const QSize &requestedSize) will not get request from system.
Bookmarks