[Solved]QTreeView based on MVC Pattern
General and Desktop
4
Posts
3
Posters
2.2k
Views
1
Watching
-
Hello everyone,
I read some articles about MVC, better to say MV, design pattern in Qt and used the Simple Tree Model example which is existed as an example in Qt_Examples in my program.
My proram is a MainWindow with different parts and functions. I put the Tree in the QTabWidget:
@
QTabWidget tabWidget = new QTabWidget;
tabWidget->addTab(new GeneralTab(), tr("General"));//The writen code in GeneralTab class
QFile file(":/default.txt");
file.open(QIODevice::ReadOnly);
TreeModel model(file.readAll());
file.close();QTreeView* treeView = new QTreeView; treeView->setModel(&model); QVBoxLayout* treeLayout = new QVBoxLayout; treeLayout->addWidget(treeView); setLayout( treeLayout);
@
The problem is nothing will be showen, in my tab!!! even no error message!
I am looking forward to the suggestions esp. solutions:)