QQmlFileSelector露

A class for applying a QFileSelector to QML file loading. More鈥�

Inheritance diagram of PySide2.QtQml.QQmlFileSelector

Synopsis露

Functions露

Static functions露

  • def get (arg__1)

Detailed Description露

QQmlFileSelector will automatically apply a QFileSelector to qml file and asset paths.

It is used as follows:

QQmlEngine engine;
QQmlFileSelector* selector = new QQmlFileSelector(&engine);

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 鈥渁sset.png鈥� file path around you would refer to it just as 鈥渁sset.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 QFileSelector .

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.

If a new QQmlFileSelector is set on the engine, the old one will be replaced. Use get() to query or use the existing instance.

class PySide2.QtQml.QQmlFileSelector(engine[, parent=None])露
param parent:

PySide2.QtCore.QObject

param engine:

PySide2.QtQml.QQmlEngine

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 .

static PySide2.QtQml.QQmlFileSelector.get(arg__1)露
Parameters:

arg__1 鈥� PySide2.QtQml.QQmlEngine

Return type:

PySide2.QtQml.QQmlFileSelector

Gets the QQmlFileSelector currently active on the target engine .

PySide2.QtQml.QQmlFileSelector.selector()露
Return type:

PySide2.QtCore.QFileSelector

Returns the QFileSelector instance used by the QQmlFileSelector .

See also

setSelector()

PySide2.QtQml.QQmlFileSelector.setExtraSelectors(strings)露
Parameters:

strings 鈥� list of strings

PySide2.QtQml.QQmlFileSelector.setExtraSelectors(strings)
Parameters:

strings 鈥� list of strings

PySide2.QtQml.QQmlFileSelector.setSelector(selector)露
Parameters:

selector 鈥� PySide2.QtCore.QFileSelector

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 (None ).

See also

selector()