psih128
31st December 2009, 01:52
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:
QModelIndex index(const QString &path, int column = 0) const;
I have another class that inherits QDirModel:
class MyDirModel : public QDirModel {
}
now when I do something like in this:
MyDirModel model;
QModelIndex index = model.index(QString("/Users/anton"), 0);
it would give compilation error:
no matching function for call to 'MyDirModel::index(QString, int)'
To workaround this I usually do something like this:
MyDirModel *model;
qobject_cast<QDirModel *>(model)->index(QString('..."), 0);
What's the trick here?
I'm on Qt 4.6 under Mac. Not sure if it's reproducible on Windows
Thanks
Anton
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:
QModelIndex index(const QString &path, int column = 0) const;
I have another class that inherits QDirModel:
class MyDirModel : public QDirModel {
}
now when I do something like in this:
MyDirModel model;
QModelIndex index = model.index(QString("/Users/anton"), 0);
it would give compilation error:
no matching function for call to 'MyDirModel::index(QString, int)'
To workaround this I usually do something like this:
MyDirModel *model;
qobject_cast<QDirModel *>(model)->index(QString('..."), 0);
What's the trick here?
I'm on Qt 4.6 under Mac. Not sure if it's reproducible on Windows
Thanks
Anton