Hi, I want to show are file system using QTreeView on a QDockWidget. Here is my code:
swatch1 is of type QDockWidget. The above code is inside a function of MainWindow. The code runs smoothly, and the tree does not show up.Qt Code:
TreeModel model(file.readAll()); file.close(); QTreeView w; w.setModel(&model); swatch1->setWidget(&w); w.setEnabled(true); addDockWidget(leftarea, swatch1);To copy to clipboard, switch view to plain text mode
I also tried another way: putting QTreeView into a QLayout, which in turn be put into QDockWidget. This 2nd code also runs smoothly, and the tree does not show up.
This code is copied from a working example on Qt Creator IDE, and I tested working. The only difference is, in the original QTreeView example, the above code is placed inside the main() { ..... } function.
Does anyone has a working example, putting QTreeView into QDockWidget and working? Thanks in advance.
Bookmarks