Hi

There is an issue with QDirModel that has been puzzling me for quite some time. There is a public function in this class with the following signature:
Qt Code:
  1. QModelIndex index(const QString &path, int column = 0) const;
To copy to clipboard, switch view to plain text mode 

I have another class that inherits QDirModel:

Qt Code:
  1. class MyDirModel : public QDirModel {
  2. }
To copy to clipboard, switch view to plain text mode 

now when I do something like in this:

Qt Code:
  1. MyDirModel model;
  2. QModelIndex index = model.index(QString("/Users/anton"), 0);
To copy to clipboard, switch view to plain text mode 

it would give compilation error:

Qt Code:
  1. no matching function for call to 'MyDirModel::index(QString, int)'
To copy to clipboard, switch view to plain text mode 

To workaround this I usually do something like this:

Qt Code:
  1. MyDirModel *model;
  2. qobject_cast<QDirModel *>(model)->index(QString('..."), 0);
To copy to clipboard, switch view to plain text mode 

What's the trick here?

I'm on Qt 4.6 under Mac. Not sure if it's reproducible on Windows

Thanks
Anton