PDA

View Full Version : QFileSystemModel with network drives not connected



GothmoG
1st October 2012, 18:24
Hi,

I use QFileSystemModel with QTreeView, and i make setRootPath on the model, like below :


QFileSystemModel* model = new QFileSystemModel;
model->setRootPath(QDir::currentPath());
ui->treeView->setModel(model);

And when my network drives are not connected it takes long time to display the QTreeView the first time.

Is there a way to avoid that? Or to detect the drives which are not connected and not display them in the tree view ?

Thanks for the help,

Hugo.

GothmoG
2nd October 2012, 17:19
More precisions from the tests i did today :
- there is no problem when my pc is not connected to a network.
- there is no problem when my pc is connected to the network used to mount the drives (P: , ...)
- there is a problem when the pc is connected to another network than the one i used to mount the drives

In this last case, my application starts very slowly. It must try to access the network drives and fail.

I launched the DirView Qt example, and there is exactly the same problem. I use Windows Xp.

Any ideas??

Thanks,

ChrisW67
3rd October 2012, 02:18
Qt does not control how long Windows attempts to contact an absent server. Windows says drive P: exists and AFAICT Qt believes it.