________________________________________
From: [email protected]
<[email protected]> on behalf of
Julius Bullinger <[email protected]>
Sent: Thursday, 13 August 2015 14:14
To: [email protected]
Subject: [Interest] How to filter QFileSystemModel for use in QML
Dear list,
I'm having problems using QFileSystemModel in QML.
Take the following example code:
// QQmlEngine* engine
QFileSystemModel* fsm = new QFileSystemModel(engine);
QModelIndex root = fsm->setRootPath("C:/Qt");
engine->rootContext()->setContextProperty("fileSystemModel", fsm);
Now, using for example a QTreeView, one could set the root by using
``QTreeWidget::setRootIndex(root)`` to filter everything above the root
level. But suppose I'd like to use the model in QML, e.g. in a TreeView
QML component which doesn't have a setRoot() property.
[snip]
I'm not sure about the rest of your question, but TreeView has a rootIndex
property in 5.6:
https://codereview.qt-project.org/#/c/121991/
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest