here is the code:
int main(int argc,char** args)
{
tree->setModel(model);
tree
->setRootIndex
( model
->index
( QDir::currentPath() ) );
lview->setModel(model);
lview
->setRootIndex
( model
->index
(QDir::currentPath()) );
for (int i = 1;i<10;i++)
stringList
->append
( QString("item %1").
arg(i
) );
StringListModel* myCustomModel = new StringListModel(*stringList);
view3->setModel(myCustomModel);
splitter->show();
return a.exec();
}
int main(int argc,char** args)
{
QApplication a(argc, argv);
QSplitter* splitter = new QSplitter();
QDirModel* model = new QDirModel();
QTreeView* tree = new QTreeView(splitter);
tree->setModel(model);
tree->setRootIndex( model->index( QDir::currentPath() ) );
QListView* lview = new QListView(splitter);
lview->setModel(model);
lview->setRootIndex( model->index(QDir::currentPath()) );
QStringList* stringList = new QStringList( QString("item 0") );
for (int i = 1;i<10;i++)
stringList->append( QString("item %1").arg(i) );
StringListModel* myCustomModel = new StringListModel(*stringList);
QTreeView* view3 = new QTreeView(splitter);
view3->setModel(myCustomModel);
splitter->show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
as i press enter i want to add new string to stringList and reflect the changes to the view.
Bookmarks