Remove usage of deprecated QAbstractItemModel::setRoleNames

Change-Id: If41bf0d6d50969156269c67a15e006d38edc8e1f
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
This commit is contained in:
Olivier Goffart 2012-02-25 21:27:03 +01:00 committed by Qt by Nokia
parent b58631ce47
commit 96cfca6151
2 changed files with 7 additions and 11 deletions

View File

@ -1926,12 +1926,10 @@ void QFileSystemModelPrivate::init()
q, SIGNAL(directoryLoaded(QString)));
q->connect(&delayedSortTimer, SIGNAL(timeout()), q, SLOT(_q_performDelayedSort()), Qt::QueuedConnection);
QHash<int, QByteArray> roles = q->roleNames();
roles.insertMulti(QFileSystemModel::FileIconRole, "fileIcon"); // == Qt::decoration
roles.insert(QFileSystemModel::FilePathRole, "filePath");
roles.insert(QFileSystemModel::FileNameRole, "fileName");
roles.insert(QFileSystemModel::FilePermissions, "filePermissions");
q->setRoleNames(roles);
roleNames.insertMulti(QFileSystemModel::FileIconRole, QByteArrayLiteral("fileIcon")); // == Qt::decoration
roleNames.insert(QFileSystemModel::FilePathRole, QByteArrayLiteral("filePath"));
roleNames.insert(QFileSystemModel::FileNameRole, QByteArrayLiteral("fileName"));
roleNames.insert(QFileSystemModel::FilePermissions, QByteArrayLiteral("filePermissions"));
}
/*!

View File

@ -1169,11 +1169,9 @@ void QDirModelPrivate::init()
root.parent = 0;
root.info = QFileInfo();
clear(&root);
QHash<int, QByteArray> roles = q->roleNames();
roles.insertMulti(QDirModel::FileIconRole, "fileIcon"); // == Qt::decoration
roles.insert(QDirModel::FilePathRole, "filePath");
roles.insert(QDirModel::FileNameRole, "fileName");
q->setRoleNames(roles);
roleNames.insertMulti(QDirModel::FileIconRole, QByteArrayLiteral("fileIcon")); // == Qt::decoration
roleNames.insert(QDirModel::FilePathRole, QByteArrayLiteral("filePath"));
roleNames.insert(QDirModel::FileNameRole, QByteArrayLiteral("fileName"));
}
QDirModelPrivate::QDirNode *QDirModelPrivate::node(int row, QDirNode *parent) const