diff options
author | Sune Vuorela <sune@vuorela.dk> | 2024-03-21 12:05:27 +0100 |
---|---|---|
committer | Sune Vuorela <sune@vuorela.dk> | 2024-04-11 23:12:42 +0100 |
commit | 19258608e9ea02043ce9b53d4a9c99700ce49c1b (patch) | |
tree | b7b54989a235c37f8eadbe0b4132d75e4f4f86f2 /tests/auto/gui/itemmodels | |
parent | c6a2f7a70e40a6df71342ffceb5eb897af71350c (diff) |
QFileSystemModel: Add role for fileinfo
Instead of having users traverse a ProxyModel hierarchy to
get to a QFileSystemModel to use the fileInfo(QModelIndex)
function, just let it be available with the roles.
Change-Id: I285347d1d85b4c6253fcb893737aa629a56e27fd
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Diffstat (limited to 'tests/auto/gui/itemmodels')
-rw-r--r-- | tests/auto/gui/itemmodels/qfilesystemmodel/tst_qfilesystemmodel.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/auto/gui/itemmodels/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/gui/itemmodels/qfilesystemmodel/tst_qfilesystemmodel.cpp index e721c8d434..8ef0b6272a 100644 --- a/tests/auto/gui/itemmodels/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/gui/itemmodels/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -811,6 +811,7 @@ void tst_QFileSystemModel::setData() QCOMPARE(spy.size(), 1); QList<QVariant> arguments = spy.takeFirst(); QCOMPARE(model->data(idx, QFileSystemModel::FileNameRole).toString(), newFileName); + QCOMPARE(model->data(idx, QFileSystemModel::FileInfoRole).value<QFileInfo>().fileName(), newFileName); QCOMPARE(model->fileInfo(idx).filePath(), tmp + '/' + newFileName); QCOMPARE(model->index(arguments.at(0).toString()), model->index(tmp)); QCOMPARE(arguments.at(1).toString(), oldFileName); |