here is my codes:
#include <QtGui>
int main(int argc, char **argv)
{
view->setModel(model);
combo->setView(view);
combo->setModel(model);
combo->show();
QString root
= "D:/";
/*QDir::rootPath();*/ combo->setRootModelIndex((static_cast<QDirModel*>(combo->model()))->index(root));
app.exec();
}
#include <QtGui>
int main(int argc, char **argv)
{
QApplication app(argc,argv);
QDirModel* model = new QDirModel();
QTreeView* view = new QTreeView();
view->setModel(model);
QComboBox* combo = new QComboBox();
combo->setView(view);
combo->setModel(model);
combo->show();
QString root = "D:/";/*QDir::rootPath();*/
combo->setRootModelIndex((static_cast<QDirModel*>(combo->model()))->index(root));
app.exec();
}
To copy to clipboard, switch view to plain text mode
the ComboBox always show the root as "C:",how can I set it to the "D:"?
I'm using Qt 4.4.0.If you use the old version such as 4.3.1,there will be a few other bugs.
thanks a lot.
Bookmarks