Fix QFileSystemModel::fileName when the index column is > 0
Fixes: QTBUG-27205 Pick-to: 6.7 6.5 Change-Id: I520a9746c8dc2a7e96ee727167915336442b01b3 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> (cherry picked from commit 5eba8693bd4df7bd891938a116ee7405bfa778bb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
7f3b17b3a6
commit
7c97e8d2a6
@ -147,7 +147,9 @@ private:
|
||||
};
|
||||
|
||||
inline QString QFileSystemModel::fileName(const QModelIndex &aindex) const
|
||||
{ return aindex.data(Qt::DisplayRole).toString(); }
|
||||
{
|
||||
return aindex.data(FileNameRole).toString();
|
||||
}
|
||||
inline QIcon QFileSystemModel::fileIcon(const QModelIndex &aindex) const
|
||||
{ return qvariant_cast<QIcon>(aindex.data(Qt::DecorationRole)); }
|
||||
|
||||
|
@ -807,6 +807,8 @@ void tst_QFileSystemModel::setData()
|
||||
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->fileName(idx), newFileName);
|
||||
QCOMPARE(model->fileName(idx.siblingAtColumn(1)), newFileName);
|
||||
QCOMPARE(model->index(arguments.at(0).toString()), model->index(tmp));
|
||||
QCOMPARE(arguments.at(1).toString(), oldFileName);
|
||||
QCOMPARE(arguments.at(2).toString(), newFileName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user