Opened 4 years ago

Last modified 4 months ago

#298 new defect

QFileSystemModel::directoryLoaded() signal passes a drive root as x: not x:/

Reported by: komh Owned by:
Priority: major Milestone: Qt 5
Component: General Version: 4.7.3
Severity: medium Keywords:
Cc:

Description

Hi/2

When connecting directoryLoaded() signal, a drive root is passed to a slot as x: not x:/.

Actually, x:/ is passed on Qt for Windows.

For example, see the following code snippets.

    QFileSystemModel* model = new QFileSystemModel;
    connect(model, SIGNAL(directoryLoaded(QString)),
            this, SLOT(directoryLoaded(QString)));

    model->setRootPath("");

    QTreeView *treeView = new QTreeView;
    treeView->setModel(model);
    treeView->setCurrentIndex(model->index(QDir::currentPath()));

And if a current directory is x:/path/to/dir, then slot directoryLoaded() receives a directory in this order.

  1. x:
  2. x:/path
  3. x:/path/to
  4. x:/path/to/dir

However, on Windows

  1. x:/
  2. x:/path
  3. x:/path/to
  4. x:/path/to/dir

I think, Windows is right. Because x: is not a fully-qualified path and it means a current directory of x: drive.

Change History (2)

comment:1 Changed 2 years ago by diver

  • Milestone changed from Qt Enhanced to Qt4 4.7.3 rerelease

comment:2 Changed 4 months ago by diver

  • Milestone changed from Qt4 4.7.3 rerelease to Qt 5

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.