[][src]Struct qt_qml::QQmlApplicationEngine

#[repr(C)]pub struct QQmlApplicationEngine { /* fields omitted */ }

This class combines a QQmlEngine and QQmlComponent to provide a convenient way to load a single QML file. It also exposes some central application functionality to QML, which a C++/QML hybrid application would normally control from C++.

C++ class: QQmlApplicationEngine.

C++ documentation:

This class combines a QQmlEngine and QQmlComponent to provide a convenient way to load a single QML file. It also exposes some central application functionality to QML, which a C++/QML hybrid application would normally control from C++.

It can be used like so:

#include <QGuiApplication> #include <QQmlApplicationEngine>

int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine("main.qml"); return app.exec(); }

Unlike QQuickView, QQmlApplicationEngine does not automatically create a root window. If you are using visual items from Qt Quick, you will need to place them inside of a Window.

You can also use QCoreApplication with QQmlApplicationEngine, if you are not using any QML modules which require a QGuiApplication (such as QtQuick).

List of configuration changes from a default QQmlEngine:

  • Connecting Qt.quit() to QCoreApplication::quit()
  • Automatically loads translation files from an i18n directory adjacent to the main QML file.
  • Automatically sets an incubation controller if the scene contains a QQuickWindow.
  • Automatically sets a QQmlFileSelector as the url interceptor, applying file selectors to all QML files and assets.

The engine behavior can be further tweaked by using the inherited methods from QQmlEngine.

Methods

impl QQmlApplicationEngine[src]

pub fn slot_load(&self) -> Receiver<(*const QUrl,)>[src]

Loads the root QML file located at url. The object tree defined by the file is created immediately for local file urls. Remote urls are loaded asynchronously, listen to the objectCreated signal to determine when the object tree is ready.

Returns a built-in Qt slot QQmlApplicationEngine::load that can be passed to qt_core::Signal::connect.

C++ documentation:

Loads the root QML file located at url. The object tree defined by the file is created immediately for local file urls. Remote urls are loaded asynchronously, listen to the objectCreated signal to determine when the object tree is ready.

If an error occurs, the objectCreated signal is emitted with a null pointer as parameter and error messages are printed with qWarning.

pub fn slot_load2(&self) -> Receiver<(*const QString,)>[src]

Loads the root QML file located at filePath. filePath must be a path to a local file. If filePath is a relative path, it is taken as relative to the application's working directory. The object tree defined by the file is instantiated immediately.

Returns a built-in Qt slot QQmlApplicationEngine::load that can be passed to qt_core::Signal::connect.

C++ documentation:

Loads the root QML file located at filePath. filePath must be a path to a local file. If filePath is a relative path, it is taken as relative to the application's working directory. The object tree defined by the file is instantiated immediately.

If an error occurs, error messages are printed with qWarning.

pub fn slot_load_data(&self) -> Receiver<(*const QByteArray, *const QUrl)>[src]

Loads the QML given in data. The object tree defined by data is instantiated immediately.

Returns a built-in Qt slot QQmlApplicationEngine::loadData that can be passed to qt_core::Signal::connect.

C++ documentation:

Loads the QML given in data. The object tree defined by data is instantiated immediately.

If a url is specified it is used as the base url of the component. This affects relative paths within the data and error messages.

If an error occurs, error messages are printed with qWarning.

pub fn object_created(&self) -> Signal<(*mut QObject, *const QUrl)>[src]

This signal is emitted when an object finishes loading. If loading was successful, object contains a pointer to the loaded object, otherwise the pointer is NULL.

Returns a built-in Qt signal QQmlApplicationEngine::objectCreated that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when an object finishes loading. If loading was successful, object contains a pointer to the loaded object, otherwise the pointer is NULL.

The url to the component the object came from is also provided.

Note: If the path to the component was provided as a QString containing a relative path, the url will contain a fully resolved path to the file.

pub unsafe fn load_q_url(&self, url: impl CastInto<Ref<QUrl>>)[src]

Loads the root QML file located at url. The object tree defined by the file is created immediately for local file urls. Remote urls are loaded asynchronously, listen to the objectCreated signal to determine when the object tree is ready.

Calls C++ function: [slot] void QQmlApplicationEngine::load(const QUrl& url).

C++ documentation:

Loads the root QML file located at url. The object tree defined by the file is created immediately for local file urls. Remote urls are loaded asynchronously, listen to the objectCreated signal to determine when the object tree is ready.

If an error occurs, the objectCreated signal is emitted with a null pointer as parameter and error messages are printed with qWarning.

pub unsafe fn load_q_string(&self, file_path: impl CastInto<Ref<QString>>)[src]

Loads the root QML file located at filePath. filePath must be a path to a local file. If filePath is a relative path, it is taken as relative to the application's working directory. The object tree defined by the file is instantiated immediately.

Calls C++ function: [slot] void QQmlApplicationEngine::load(const QString& filePath).

C++ documentation:

Loads the root QML file located at filePath. filePath must be a path to a local file. If filePath is a relative path, it is taken as relative to the application's working directory. The object tree defined by the file is instantiated immediately.

If an error occurs, error messages are printed with qWarning.

pub unsafe fn load_data_2a(
    &self,
    data: impl CastInto<Ref<QByteArray>>,
    url: impl CastInto<Ref<QUrl>>
)
[src]

Loads the QML given in data. The object tree defined by data is instantiated immediately.

Calls C++ function: [slot] void QQmlApplicationEngine::loadData(const QByteArray& data, const QUrl& url = …).

C++ documentation:

Loads the QML given in data. The object tree defined by data is instantiated immediately.

If a url is specified it is used as the base url of the component. This affects relative paths within the data and error messages.

If an error occurs, error messages are printed with qWarning.

pub unsafe fn load_data_1a(&self, data: impl CastInto<Ref<QByteArray>>)[src]

Loads the QML given in data. The object tree defined by data is instantiated immediately.

Calls C++ function: [slot] void QQmlApplicationEngine::loadData(const QByteArray& data).

C++ documentation:

Loads the QML given in data. The object tree defined by data is instantiated immediately.

If a url is specified it is used as the base url of the component. This affects relative paths within the data and error messages.

If an error occurs, error messages are printed with qWarning.

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QQmlApplicationEngine::metaObject() const.

pub unsafe fn from_q_object(
    parent: impl CastInto<Ptr<QObject>>
) -> QBox<QQmlApplicationEngine>
[src]

Create a new QQmlApplicationEngine with the given parent. You will have to call load() later in order to load a QML file.

Calls C++ function: [constructor] void QQmlApplicationEngine::QQmlApplicationEngine(QObject* parent = …).

C++ documentation:

Create a new QQmlApplicationEngine with the given parent. You will have to call load() later in order to load a QML file.

pub unsafe fn from_q_url_q_object(
    url: impl CastInto<Ref<QUrl>>,
    parent: impl CastInto<Ptr<QObject>>
) -> QBox<QQmlApplicationEngine>
[src]

Create a new QQmlApplicationEngine and loads the QML file at the given url. This is provided as a convenience, and is the same as using the empty constructor and calling load afterwards.

Calls C++ function: [constructor] void QQmlApplicationEngine::QQmlApplicationEngine(const QUrl& url, QObject* parent = …).

C++ documentation:

Create a new QQmlApplicationEngine and loads the QML file at the given url. This is provided as a convenience, and is the same as using the empty constructor and calling load afterwards.

pub unsafe fn from_q_string_q_object(
    file_path: impl CastInto<Ref<QString>>,
    parent: impl CastInto<Ptr<QObject>>
) -> QBox<QQmlApplicationEngine>
[src]

Create a new QQmlApplicationEngine and loads the QML file at the given filePath, which must be a local file path. If a relative path is given then it will be interpreted as relative to the working directory of the application.

Calls C++ function: [constructor] void QQmlApplicationEngine::QQmlApplicationEngine(const QString& filePath, QObject* parent = …).

C++ documentation:

Create a new QQmlApplicationEngine and loads the QML file at the given filePath, which must be a local file path. If a relative path is given then it will be interpreted as relative to the working directory of the application.

This is provided as a convenience, and is the same as using the empty constructor and calling load afterwards.

pub unsafe fn new() -> QBox<QQmlApplicationEngine>[src]

This class combines a QQmlEngine and QQmlComponent to provide a convenient way to load a single QML file. It also exposes some central application functionality to QML, which a C++/QML hybrid application would normally control from C++.

Calls C++ function: [constructor] void QQmlApplicationEngine::QQmlApplicationEngine().

C++ documentation:

This class combines a QQmlEngine and QQmlComponent to provide a convenient way to load a single QML file. It also exposes some central application functionality to QML, which a C++/QML hybrid application would normally control from C++.

It can be used like so:

#include <QGuiApplication> #include <QQmlApplicationEngine>

int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine("main.qml"); return app.exec(); }

Unlike QQuickView, QQmlApplicationEngine does not automatically create a root window. If you are using visual items from Qt Quick, you will need to place them inside of a Window.

You can also use QCoreApplication with QQmlApplicationEngine, if you are not using any QML modules which require a QGuiApplication (such as QtQuick).

List of configuration changes from a default QQmlEngine:

  • Connecting Qt.quit() to QCoreApplication::quit()
  • Automatically loads translation files from an i18n directory adjacent to the main QML file.
  • Automatically sets an incubation controller if the scene contains a QQuickWindow.
  • Automatically sets a QQmlFileSelector as the url interceptor, applying file selectors to all QML files and assets.

The engine behavior can be further tweaked by using the inherited methods from QQmlEngine.

pub unsafe fn from_q_url(
    url: impl CastInto<Ref<QUrl>>
) -> QBox<QQmlApplicationEngine>
[src]

Create a new QQmlApplicationEngine and loads the QML file at the given url. This is provided as a convenience, and is the same as using the empty constructor and calling load afterwards.

Calls C++ function: [constructor] void QQmlApplicationEngine::QQmlApplicationEngine(const QUrl& url).

C++ documentation:

Create a new QQmlApplicationEngine and loads the QML file at the given url. This is provided as a convenience, and is the same as using the empty constructor and calling load afterwards.

pub unsafe fn from_q_string(
    file_path: impl CastInto<Ref<QString>>
) -> QBox<QQmlApplicationEngine>
[src]

Create a new QQmlApplicationEngine and loads the QML file at the given filePath, which must be a local file path. If a relative path is given then it will be interpreted as relative to the working directory of the application.

Calls C++ function: [constructor] void QQmlApplicationEngine::QQmlApplicationEngine(const QString& filePath).

C++ documentation:

Create a new QQmlApplicationEngine and loads the QML file at the given filePath, which must be a local file path. If a relative path is given then it will be interpreted as relative to the working directory of the application.

This is provided as a convenience, and is the same as using the empty constructor and calling load afterwards.

pub unsafe fn qt_metacall(
    &self,
    arg1: Call,
    arg2: c_int,
    arg3: *mut *mut c_void
) -> c_int
[src]

Calls C++ function: virtual int QQmlApplicationEngine::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void[src]

Calls C++ function: virtual void* QQmlApplicationEngine::qt_metacast(const char* arg1).

pub unsafe fn root_objects_mut(&self) -> CppBox<QListOfQObject>[src]

Returns a list of all the root objects instantiated by the QQmlApplicationEngine. This will only contain objects loaded via load() or a convenience constructor.

Calls C++ function: QList<QObject*> QQmlApplicationEngine::rootObjects().

C++ documentation:

Returns a list of all the root objects instantiated by the QQmlApplicationEngine. This will only contain objects loaded via load() or a convenience constructor.

Note: In Qt versions prior to 5.9, this function is marked as non-const.

pub unsafe fn root_objects(&self) -> CppBox<QListOfQObject>[src]

Returns a list of all the root objects instantiated by the QQmlApplicationEngine. This will only contain objects loaded via load() or a convenience constructor.

Calls C++ function: QList<QObject*> QQmlApplicationEngine::rootObjects() const.

C++ documentation:

Returns a list of all the root objects instantiated by the QQmlApplicationEngine. This will only contain objects loaded via load() or a convenience constructor.

Note: In Qt versions prior to 5.9, this function is marked as non-const.

pub unsafe fn set_initial_properties(
    &self,
    initial_properties: impl CastInto<Ref<QMapOfQStringQVariant>>
)
[src]

This is supported on cpp_lib_version="5.14.0" only.

Sets the initialProperties with which the QML component gets initialized after it gets loaded.

Calls C++ function: void QQmlApplicationEngine::setInitialProperties(const QMap<QString, QVariant>& initialProperties).

C++ documentation:

Sets the initialProperties with which the QML component gets initialized after it gets loaded.

This function was introduced in Qt 5.14.

See also QQmlComponent::setInitialProperties, QQmlApplicationEngine::load, and QQmlApplicationEngine::loadData.

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

pub unsafe fn tr(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QQmlApplicationEngine::tr(const char* s, const char* c, int n).

pub unsafe fn tr_utf8(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QQmlApplicationEngine::trUtf8(const char* s, const char* c, int n).

Methods from Deref<Target = QQmlEngine>

pub fn slot_retranslate(&self) -> Receiver<()>[src]

Refreshes all binding expressions that use strings marked for translation.

Returns a built-in Qt slot QQmlEngine::retranslate that can be passed to qt_core::Signal::connect.

C++ documentation:

Refreshes all binding expressions that use strings marked for translation.

Call this function after you have installed a new translator with QCoreApplication::installTranslator, to ensure that your user-interface shows up-to-date translations.

Note: Due to a limitation in the implementation, this function refreshes all the engine's bindings, not only those that use strings marked for translation. This may be optimized in a future release.

This function was introduced in Qt 5.10.

pub fn quit(&self) -> Signal<()>[src]

This signal is emitted when the QML loaded by the engine would like to quit.

Returns a built-in Qt signal QQmlEngine::quit that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when the QML loaded by the engine would like to quit.

See also exit().

pub fn exit(&self) -> Signal<(c_int,)>[src]

This signal is emitted when the QML loaded by the engine would like to exit from the event loop with the specified return code retCode.

Returns a built-in Qt signal QQmlEngine::exit that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when the QML loaded by the engine would like to exit from the event loop with the specified return code retCode.

This function was introduced in Qt 5.8.

See also quit().

pub fn warnings(&self) -> Signal<(*const QListOfQQmlError,)>[src]

This signal is emitted when warnings messages are generated by QML.

Returns a built-in Qt signal QQmlEngine::warnings that can be passed to qt_core::Signal::connect.

C++ documentation:

This signal is emitted when warnings messages are generated by QML.

pub unsafe fn add_image_provider(
    &self,
    id: impl CastInto<Ref<QString>>,
    arg2: impl CastInto<Ptr<QQmlImageProviderBase>>
)
[src]

Sets the provider to use for images requested via the image: url scheme, with host providerId. The QQmlEngine takes ownership of provider.

Calls C++ function: void QQmlEngine::addImageProvider(const QString& id, QQmlImageProviderBase* arg2).

C++ documentation:

Sets the provider to use for images requested via the image: url scheme, with host providerId. The QQmlEngine takes ownership of provider.

Image providers enable support for pixmap and threaded image requests. See the QQuickImageProvider documentation for details on implementing and using image providers.

All required image providers should be added to the engine before any QML sources files are loaded.

See also removeImageProvider(), QQuickImageProvider, and QQmlImageProviderBase.

pub unsafe fn add_import_path(&self, dir: impl CastInto<Ref<QString>>)[src]

Adds path as a directory where the engine searches for installed modules in a URL-based directory structure.

Calls C++ function: void QQmlEngine::addImportPath(const QString& dir).

C++ documentation:

Adds path as a directory where the engine searches for installed modules in a URL-based directory structure.

The path may be a local filesystem directory, a Qt Resource path (:/imports), a Qt Resource url (qrc:/imports) or a URL.

The path will be converted into canonical form before it is added to the import path list.

The newly added path will be first in the importPathList().

See also setImportPathList() and QML Modules.

pub unsafe fn add_named_bundle(
    &self,
    name: impl CastInto<Ref<QString>>,
    file_name: impl CastInto<Ref<QString>>
) -> bool
[src]

Calls C++ function: bool QQmlEngine::addNamedBundle(const QString& name, const QString& fileName).

pub unsafe fn add_plugin_path(&self, dir: impl CastInto<Ref<QString>>)[src]

Adds path as a directory where the engine searches for native plugins for imported modules (referenced in the qmldir file).

Calls C++ function: void QQmlEngine::addPluginPath(const QString& dir).

C++ documentation:

Adds path as a directory where the engine searches for native plugins for imported modules (referenced in the qmldir file).

By default, the list contains only ., i.e. the engine searches in the directory of the qmldir file itself.

The newly added path will be first in the pluginPathList().

See also setPluginPathList().

pub unsafe fn base_url(&self) -> CppBox<QUrl>[src]

Return the base URL for this engine. The base URL is only used to resolve components when a relative URL is passed to the QQmlComponent constructor.

Calls C++ function: QUrl QQmlEngine::baseUrl() const.

C++ documentation:

Return the base URL for this engine. The base URL is only used to resolve components when a relative URL is passed to the QQmlComponent constructor.

If a base URL has not been explicitly set, this method returns the application's current working directory.

See also setBaseUrl().

pub unsafe fn clear_component_cache(&self)[src]

Clears the engine's internal component cache.

Calls C++ function: void QQmlEngine::clearComponentCache().

C++ documentation:

Clears the engine's internal component cache.

This function causes the property metadata of all components previously loaded by the engine to be destroyed. All previously loaded components and the property bindings for all extant objects created from those components will cease to function.

This function returns the engine to a state where it does not contain any loaded component data. This may be useful in order to reload a smaller subset of the previous component set, or to load a new version of a previously loaded component.

Once the component cache has been cleared, components must be loaded before any new objects can be created.

See also trimComponentCache().

pub unsafe fn image_provider(
    &self,
    id: impl CastInto<Ref<QString>>
) -> Ptr<QQmlImageProviderBase>
[src]

Returns the image provider set for providerId if found; otherwise returns nullptr.

Calls C++ function: QQmlImageProviderBase* QQmlEngine::imageProvider(const QString& id) const.

C++ documentation:

Returns the image provider set for providerId if found; otherwise returns nullptr.

See also QQuickImageProvider.

pub unsafe fn import_path_list(&self) -> CppBox<QStringList>[src]

Returns the list of directories where the engine searches for installed modules in a URL-based directory structure.

Calls C++ function: QStringList QQmlEngine::importPathList() const.

C++ documentation:

Returns the list of directories where the engine searches for installed modules in a URL-based directory structure.

For example, if /opt/MyApp/lib/imports is in the path, then QML that imports com.mycompany.Feature will cause the QQmlEngine to look in /opt/MyApp/lib/imports/com/mycompany/Feature/ for the components provided by that module. A qmldir file is required for defining the type version mapping and possibly QML extensions plugins.

By default, the list contains the directory of the application executable, paths specified in the QML2_IMPORT_PATH environment variable, and the builtin Qml2ImportsPath from QLibraryInfo.

See also addImportPath() and setImportPathList().

pub unsafe fn import_plugin(
    &self,
    file_path: impl CastInto<Ref<QString>>,
    uri: impl CastInto<Ref<QString>>,
    errors: impl CastInto<Ptr<QListOfQQmlError>>
) -> bool
[src]

Imports the plugin named filePath with the uri provided. Returns true if the plugin was successfully imported; otherwise returns false.

Calls C++ function: bool QQmlEngine::importPlugin(const QString& filePath, const QString& uri, QList<QQmlError>* errors).

C++ documentation:

Imports the plugin named filePath with the uri provided. Returns true if the plugin was successfully imported; otherwise returns false.

On failure and if non-null, the errors list will have any errors which occurred prepended to it.

The plugin has to be a Qt plugin which implements the QQmlExtensionPlugin interface.

pub unsafe fn incubation_controller(&self) -> Ptr<QQmlIncubationController>[src]

Returns the currently set incubation controller, or 0 if no controller has been set.

Calls C++ function: QQmlIncubationController* QQmlEngine::incubationController() const.

C++ documentation:

Returns the currently set incubation controller, or 0 if no controller has been set.

See also setIncubationController().

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QQmlEngine::metaObject() const.

pub unsafe fn network_access_manager_factory(
    &self
) -> Ptr<QQmlNetworkAccessManagerFactory>
[src]

Returns the current QQmlNetworkAccessManagerFactory.

Calls C++ function: QQmlNetworkAccessManagerFactory* QQmlEngine::networkAccessManagerFactory() const.

C++ documentation:

Returns the current QQmlNetworkAccessManagerFactory.

See also setNetworkAccessManagerFactory().

pub unsafe fn offline_storage_database_file_path(
    &self,
    database_name: impl CastInto<Ref<QString>>
) -> CppBox<QString>
[src]

Returns the file path where a Local Storage database with the identifier databaseName is (or would be) located.

Calls C++ function: QString QQmlEngine::offlineStorageDatabaseFilePath(const QString& databaseName) const.

C++ documentation:

Returns the file path where a Local Storage database with the identifier databaseName is (or would be) located.

This function was introduced in Qt 5.9.

See also LocalStorage.openDatabaseSync().

pub unsafe fn offline_storage_path(&self) -> CppBox<QString>[src]

This property holds the directory for storing offline user data

Calls C++ function: QString QQmlEngine::offlineStoragePath() const.

C++ documentation:

This property holds the directory for storing offline user data

Returns the directory where SQL and other offline storage is placed.

The SQL databases created with openDatabase() are stored here.

The default is QML/OfflineStorage in the platform-standard user application data directory.

Note that the path may not currently exist on the filesystem, so callers wanting to create new files at this location should create it first - see QDir::mkpath().

Access functions:

QString offlineStoragePath() const
void setOfflineStoragePath(const QString &dir)

pub unsafe fn output_warnings_to_standard_error(&self) -> bool[src]

Returns true if warning messages will be output to stderr in addition to being emitted by the warnings() signal, otherwise false.

Calls C++ function: bool QQmlEngine::outputWarningsToStandardError() const.

C++ documentation:

Returns true if warning messages will be output to stderr in addition to being emitted by the warnings() signal, otherwise false.

The default value is true.

See also setOutputWarningsToStandardError().

pub unsafe fn plugin_path_list(&self) -> CppBox<QStringList>[src]

Returns the list of directories where the engine searches for native plugins for imported modules (referenced in the qmldir file).

Calls C++ function: QStringList QQmlEngine::pluginPathList() const.

C++ documentation:

Returns the list of directories where the engine searches for native plugins for imported modules (referenced in the qmldir file).

By default, the list contains only ., i.e. the engine searches in the directory of the qmldir file itself.

See also addPluginPath() and setPluginPathList().

pub unsafe fn qt_metacall(
    &self,
    arg1: Call,
    arg2: c_int,
    arg3: *mut *mut c_void
) -> c_int
[src]

Calls C++ function: virtual int QQmlEngine::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void[src]

Calls C++ function: virtual void* QQmlEngine::qt_metacast(const char* arg1).

pub unsafe fn remove_image_provider(&self, id: impl CastInto<Ref<QString>>)[src]

Removes the image provider for providerId.

Calls C++ function: void QQmlEngine::removeImageProvider(const QString& id).

C++ documentation:

Removes the image provider for providerId.

See also addImageProvider() and QQuickImageProvider.

pub unsafe fn retranslate(&self)[src]

This is supported on cpp_lib_version="5.13.0" or cpp_lib_version="5.11.3" or cpp_lib_version="5.12.2" or cpp_lib_version="5.14.0" only.

Refreshes all binding expressions that use strings marked for translation.

Calls C++ function: [slot] void QQmlEngine::retranslate().

C++ documentation:

Refreshes all binding expressions that use strings marked for translation.

Call this function after you have installed a new translator with QCoreApplication::installTranslator, to ensure that your user-interface shows up-to-date translations.

Note: Due to a limitation in the implementation, this function refreshes all the engine's bindings, not only those that use strings marked for translation. This may be optimized in a future release.

This function was introduced in Qt 5.10.

pub unsafe fn root_context(&self) -> QPtr<QQmlContext>[src]

Returns the engine's root context.

Calls C++ function: QQmlContext* QQmlEngine::rootContext() const.

C++ documentation:

Returns the engine's root context.

The root context is automatically created by the QQmlEngine. Data that should be available to all QML component instances instantiated by the engine should be put in the root context.

Additional data that should only be available to a subset of component instances should be added to sub-contexts parented to the root context.

pub unsafe fn set_base_url(&self, arg1: impl CastInto<Ref<QUrl>>)[src]

Set the base URL for this engine to url.

Calls C++ function: void QQmlEngine::setBaseUrl(const QUrl& arg1).

C++ documentation:

Set the base URL for this engine to url.

See also baseUrl().

pub unsafe fn set_import_path_list(
    &self,
    paths: impl CastInto<Ref<QStringList>>
)
[src]

Sets paths as the list of directories where the engine searches for installed modules in a URL-based directory structure.

Calls C++ function: void QQmlEngine::setImportPathList(const QStringList& paths).

C++ documentation:

Sets paths as the list of directories where the engine searches for installed modules in a URL-based directory structure.

By default, the list contains the directory of the application executable, paths specified in the QML2_IMPORT_PATH environment variable, and the builtin Qml2ImportsPath from QLibraryInfo.

See also importPathList() and addImportPath().

pub unsafe fn set_incubation_controller(
    &self,
    arg1: impl CastInto<Ptr<QQmlIncubationController>>
)
[src]

Sets the engine's incubation controller. The engine can only have one active controller and it does not take ownership of it.

Calls C++ function: void QQmlEngine::setIncubationController(QQmlIncubationController* arg1).

C++ documentation:

Sets the engine's incubation controller. The engine can only have one active controller and it does not take ownership of it.

See also incubationController().

pub unsafe fn set_network_access_manager_factory(
    &self,
    arg1: impl CastInto<Ptr<QQmlNetworkAccessManagerFactory>>
)
[src]

Sets the factory to use for creating QNetworkAccessManager(s).

Calls C++ function: void QQmlEngine::setNetworkAccessManagerFactory(QQmlNetworkAccessManagerFactory* arg1).

C++ documentation:

Sets the factory to use for creating QNetworkAccessManager(s).

QNetworkAccessManager is used for all network access by QML. By implementing a factory it is possible to create custom QNetworkAccessManager with specialized caching, proxy and cookie support.

The factory must be set before executing the engine.

Note: QQmlEngine does not take ownership of the factory.

See also networkAccessManagerFactory().

pub unsafe fn set_offline_storage_path(&self, dir: impl CastInto<Ref<QString>>)[src]

This property holds the directory for storing offline user data

Calls C++ function: void QQmlEngine::setOfflineStoragePath(const QString& dir).

C++ documentation:

This property holds the directory for storing offline user data

Returns the directory where SQL and other offline storage is placed.

The SQL databases created with openDatabase() are stored here.

The default is QML/OfflineStorage in the platform-standard user application data directory.

Note that the path may not currently exist on the filesystem, so callers wanting to create new files at this location should create it first - see QDir::mkpath().

Access functions:

QString offlineStoragePath() const
void setOfflineStoragePath(const QString &dir)

pub unsafe fn set_output_warnings_to_standard_error(&self, arg1: bool)[src]

Set whether warning messages will be output to stderr to enabled.

Calls C++ function: void QQmlEngine::setOutputWarningsToStandardError(bool arg1).

C++ documentation:

Set whether warning messages will be output to stderr to enabled.

If enabled is true, any warning messages generated by QML will be output to stderr and emitted by the warnings() signal. If enabled is false, only the warnings() signal will be emitted. This allows applications to handle warning output themselves.

The default value is true.

See also outputWarningsToStandardError().

pub unsafe fn set_plugin_path_list(
    &self,
    paths: impl CastInto<Ref<QStringList>>
)
[src]

Sets the list of directories where the engine searches for native plugins for imported modules (referenced in the qmldir file) to paths.

Calls C++ function: void QQmlEngine::setPluginPathList(const QStringList& paths).

C++ documentation:

Sets the list of directories where the engine searches for native plugins for imported modules (referenced in the qmldir file) to paths.

By default, the list contains only ., i.e. the engine searches in the directory of the qmldir file itself.

See also pluginPathList() and addPluginPath().

pub unsafe fn set_url_interceptor(
    &self,
    url_interceptor: impl CastInto<Ptr<QQmlAbstractUrlInterceptor>>
)
[src]

Calls C++ function: void QQmlEngine::setUrlInterceptor(QQmlAbstractUrlInterceptor* urlInterceptor).

pub unsafe fn trim_component_cache(&self)[src]

Trims the engine's internal component cache.

Calls C++ function: void QQmlEngine::trimComponentCache().

C++ documentation:

Trims the engine's internal component cache.

This function causes the property metadata of any loaded components which are not currently in use to be destroyed.

A component is considered to be in use if there are any extant instances of the component itself, any instances of other components that use the component, or any objects instantiated by any of those components.

See also clearComponentCache().

pub unsafe fn url_interceptor(&self) -> Ptr<QQmlAbstractUrlInterceptor>[src]

Calls C++ function: QQmlAbstractUrlInterceptor* QQmlEngine::urlInterceptor() const.

Trait Implementations

impl CppDeletable for QQmlApplicationEngine[src]

unsafe fn delete(&self)[src]

Destroys the QQmlApplicationEngine and all QML objects it loaded.

Calls C++ function: virtual [destructor] void QQmlApplicationEngine::~QQmlApplicationEngine().

C++ documentation:

Destroys the QQmlApplicationEngine and all QML objects it loaded.

impl Deref for QQmlApplicationEngine[src]

type Target = QQmlEngine

The resulting type after dereferencing.

fn deref(&self) -> &QQmlEngine[src]

Calls C++ function: QQmlEngine* static_cast<QQmlEngine*>(QQmlApplicationEngine* ptr).

impl DynamicCast<QQmlApplicationEngine> for QQmlEngine[src]

unsafe fn dynamic_cast(ptr: Ptr<QQmlEngine>) -> Ptr<QQmlApplicationEngine>[src]

Calls C++ function: QQmlApplicationEngine* dynamic_cast<QQmlApplicationEngine*>(QQmlEngine* ptr).

impl DynamicCast<QQmlApplicationEngine> for QJSEngine[src]

unsafe fn dynamic_cast(ptr: Ptr<QJSEngine>) -> Ptr<QQmlApplicationEngine>[src]

Calls C++ function: QQmlApplicationEngine* dynamic_cast<QQmlApplicationEngine*>(QJSEngine* ptr).

impl DynamicCast<QQmlApplicationEngine> for QObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QQmlApplicationEngine>[src]

Calls C++ function: QQmlApplicationEngine* dynamic_cast<QQmlApplicationEngine*>(QObject* ptr).

impl StaticDowncast<QQmlApplicationEngine> for QQmlEngine[src]

unsafe fn static_downcast(ptr: Ptr<QQmlEngine>) -> Ptr<QQmlApplicationEngine>[src]

Calls C++ function: QQmlApplicationEngine* static_cast<QQmlApplicationEngine*>(QQmlEngine* ptr).

impl StaticDowncast<QQmlApplicationEngine> for QJSEngine[src]

unsafe fn static_downcast(ptr: Ptr<QJSEngine>) -> Ptr<QQmlApplicationEngine>[src]

Calls C++ function: QQmlApplicationEngine* static_cast<QQmlApplicationEngine*>(QJSEngine* ptr).

impl StaticDowncast<QQmlApplicationEngine> for QObject[src]

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QQmlApplicationEngine>[src]

Calls C++ function: QQmlApplicationEngine* static_cast<QQmlApplicationEngine*>(QObject* ptr).

impl StaticUpcast<QJSEngine> for QQmlApplicationEngine[src]

unsafe fn static_upcast(ptr: Ptr<QQmlApplicationEngine>) -> Ptr<QJSEngine>[src]

Calls C++ function: QJSEngine* static_cast<QJSEngine*>(QQmlApplicationEngine* ptr).

impl StaticUpcast<QObject> for QQmlApplicationEngine[src]

unsafe fn static_upcast(ptr: Ptr<QQmlApplicationEngine>) -> Ptr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QQmlApplicationEngine* ptr).

impl StaticUpcast<QQmlEngine> for QQmlApplicationEngine[src]

unsafe fn static_upcast(ptr: Ptr<QQmlApplicationEngine>) -> Ptr<QQmlEngine>[src]

Calls C++ function: QQmlEngine* static_cast<QQmlEngine*>(QQmlApplicationEngine* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.