Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
4.8.4, 5.1.0 Beta 1
-
Windows
-
3d08816f4 (dev), 42439087e (6.8), fbe61def3 (dev), ea4c74cca (6.8)
Description
Currently QFileSystemModel assumes all paths are properly capitalized as they are in the file system. If incorrectly capitalized path is given, duplicate nodes will result in QFileSystemModel.
#include <QApplication> #include <QFileSystemModel> #include <QListView> #include <QHBoxLayout> #include <QDir> #include <QDebug> #include <QTimer> class Widget : public QWidget { Q_OBJECT public: Widget() :fileModel(new QFileSystemModel),fileView(new QListView) { QFile fileForTest("AaaBbbCcc.Dat"); fileForTest.open(QFile::WriteOnly); fileForTest.close(); fileModel->setRootPath(QDir::currentPath()); fileView->setModel(fileModel); fileView->setRootIndex(fileModel->index(QDir::currentPath())); QHBoxLayout *box = new QHBoxLayout(this); box->addWidget(fileView); QTimer::singleShot(100, this, SLOT(output())); } private slots: void output() { int idx0 = fileModel->index("AaaBbbCcc.Dat").row(); int idx1 = fileModel->index("aaabbbccc.dat").row(); int idx2 = fileModel->index("AAABBBCCC.DAT").row(); qDebug()<<idx0<<idx1<<idx2; } private: QFileSystemModel *fileModel; QListView *fileView; }; int main(int argc, char *argv[]) { QApplication a(argc, argv); Widget w; w.show(); return a.exec(); } #include "main.moc"
Attachments
Issue Links
- relates to
-
QTBUG-64147 Windows: assert in QFileSystemModel when setting the same root path 2 times in a row
- Closed