|qmake:||QT += qml|
|QQmlFileSelector(QQmlEngine *engine, QObject *parent = Q_NULLPTR)|
|void||setExtraSelectors(const QStringList &strings)|
- 31 public functions inherited from QObject
Static Public Members
|QQmlFileSelector *||get(QQmlEngine *engine)|
- 11 static public members inherited from QObject
Additional Inherited Members
- 1 property inherited from QObject
- 1 public slot inherited from QObject
- 2 signals inherited from QObject
- 9 protected functions inherited from QObject
A class for applying a QFileSelector to QML file loading
It is used as follows:
Then you can swap out files like so:
main.qml Component.qml asset.png +unix/Component.qml +mac/asset.png
In this example, main.qml will normally use Component.qml for the Component type. However on a unix platform, the unix selector will be present and the +unix/Component.qml version will be used instead. Note that this acts like swapping out Component.qml with +unix/Component.qml, so when using Component.qml you should not need to alter any paths based on which version was selected.
For example, to pass the "asset.png" file path around you would refer to it just as "asset.png" in all of main.qml, Component.qml, and +linux/Component.qml. It will be replaced with +mac/asset.png on Mac platforms in all cases.
For a list of available selectors, see
Your platform may also provide additional selectors for you to use. As specified by QFileSelector, directories used for selection must start with a '+' character, so you will not accidentally trigger this feature unless you have directories with such names inside your project.
Member Function Documentation
QQmlFileSelector::QQmlFileSelector(QQmlEngine *engine, QObject *parent = Q_NULLPTR)
Creates a new QQmlFileSelector with parent object parent, which includes its own QFileSelector. engine is the QQmlEngine you wish to apply file selectors to. It will also take ownership of the QQmlFileSelector.
Destroys the QQmlFileSelector object.
[static] QQmlFileSelector *QQmlFileSelector::get(QQmlEngine *engine)
Gets the QQmlFileSelector currently active on the target engine.
void QQmlFileSelector::setExtraSelectors(QStringList &strings)
void QQmlFileSelector::setExtraSelectors(const QStringList &strings)
void QQmlFileSelector::setSelector(QFileSelector *selector)
Sets the QFileSelector instance for use by the QQmlFileSelector to selector. QQmlFileSelector does not take ownership of the new QFileSelector. To reset QQmlFileSelector to use its internal QFileSelector instance, call setSelector(0).
© 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.