A simple indeed treeview does not display anything upon a correct QFileSystemModel
Solved
General and Desktop
-
It's weird that the code below does not work -- I copied almost everything from the qt4.8 example.
I can have a window, but nothing is displayed in the treeview. It's completely blank.
The code below is literally all I have, except main.cpp which I keep as the original.What I got from qDebug is 'D:/', so the model is correct.
BTW, I tried to search for similar issues so that I don't ask silly and duplicated questions, but it seems there is no such engine to poll ...
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { QTreeView *treeView = new QTreeView(this); // set up treeview QFileSystemModel model; model.setRootPath("d:/"); treeView->setModel(&model); qDebug(model.rootPath().toAscii().data()); // Demonstrating look and feel features treeView->setAnimated(false); treeView->setIndentation(20); treeView->setSortingEnabled(true); this->setCentralWidget(treeView); }