Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.11.1, 5.11.2
-
-
5
-
e253a30238ed1a93877780428c035d3b7a53e22a (qt/qtbase/dev) b67bbed1965ce9931a6280daeb1d2a05a3c905a5 (qt/qtbase/6.0) 5369a28df650c8f09e30dbf5c23746e103a87e7f (qt/qtbase/6.1) 95694109e9ec8200239f9a9aae7a789fe565c5e9 (qt/tqtc-qtbase/5.15)
-
Qt6_Foundation_Sprint 33, Qt6_Foundation_Sprint 34
Description
When I was investigating QTBUG-71700, I discovered this issue.
In QFileSystemModel, in some cases the hostname in a UNC path is converted to lower case and stored in the root node's visibleChildren.When QFileSystemModel sets the UNC path as the root path, it tries to get the index of the host, but it didn't convert the hostname to lower case before getting the row number, which resulted in the host not found in the root node's visible children. As a result, it returns an invalid index.
Code to duplicate this issue:
int main(int argc, char *argv[]) { QApplication a(argc, argv); QFileSystemModel model; QModelIndex index = model.setRootPath(QLatin1String("//<server-in-lower-case>")); index = model.setRootPath(QLatin1String("//<server>")); if (index.isValid()) qDebug() << model.rootPath() << model.filePath(index) << index.row(); else qDebug() << "Invalid index"; return 0; }
output:
"5.12.0 windows" host= "host" rp= "\\\\host" rootPath= "//host" file path= "//host" row= 0 rp= "\\\\HOST" Invalid index
Attachments
For Gerrit Dashboard: QTBUG-71701 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
245163,2 | QFileSystemModel fails to locate a host from root's visible children | 5.11.3 | qt/qtbase | Status: ABANDONED | 0 | 0 |
246140,6 | QFileSystemModel fails to locate a host from root's visible children | dev | qt/qtbase | Status: MERGED | +2 | 0 |
350095,3 | QFileSystemModel fails to locate a host from root's visible children | 6.1 | qt/qtbase | Status: MERGED | +2 | 0 |
350096,3 | QFileSystemModel fails to locate a host from root's visible children | 6.0 | qt/qtbase | Status: MERGED | +2 | 0 |
350101,3 | QFileSystemModel fails to locate a host from root's visible children | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |