1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
// SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
// SPDX-FileContributor: Andrew Hayzen <andrew.hayzen@kdab.com>
//
// SPDX-License-Identifier: MIT OR Apache-2.0
#[cxx::bridge]
mod ffi {
unsafe extern "C++" {
include!("cxx-qt-lib/qstring.h");
type QString = crate::QString;
include!("cxx-qt-lib/qstringlist.h");
type QStringList = crate::QStringList;
include!("cxx-qt-lib/qurl.h");
type QUrl = crate::QUrl;
include!("cxx-qt-lib/qqmlapplicationengine.h");
type QQmlApplicationEngine;
/// Adds path as a directory where the engine searches for installed modules in a URL-based directory structure.
#[rust_name = "add_import_path"]
fn addImportPath(self: Pin<&mut QQmlApplicationEngine>, path: &QString);
/// Adds path as a directory where the engine searches for native plugins for imported modules (referenced in the qmldir file).
#[rust_name = "add_plugin_path"]
fn addPluginPath(self: Pin<&mut QQmlApplicationEngine>, path: &QString);
/// 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.
#[rust_name = "base_url"]
fn baseUrl(self: &QQmlApplicationEngine) -> QUrl;
/// Returns the list of directories where the engine searches for installed modules in a URL-based directory structure.
#[rust_name = "import_path_list"]
fn importPathList(self: &QQmlApplicationEngine) -> QStringList;
/// Loads the root QML file located at url.
fn load(self: Pin<&mut QQmlApplicationEngine>, url: &QUrl);
/// Returns the list of directories where the engine searches for native plugins for imported modules (referenced in the qmldir file).
#[rust_name = "plugin_path_list"]
fn pluginPathList(self: &QQmlApplicationEngine) -> QStringList;
/// Set the base URL for this engine to url.
#[rust_name = "set_base_url"]
fn setBaseUrl(self: Pin<&mut QQmlApplicationEngine>, url: &QUrl);
/// Sets paths as the list of directories where the engine searches for installed modules in a URL-based directory structure.
#[rust_name = "set_import_path_list"]
fn setImportPathList(self: Pin<&mut QQmlApplicationEngine>, paths: &QStringList);
/// Sets the list of directories where the engine searches for native plugins for imported modules (referenced in the qmldir file) to paths.
#[rust_name = "set_plugin_path_list"]
fn setPluginPathList(self: Pin<&mut QQmlApplicationEngine>, paths: &QStringList);
}
#[namespace = "rust::cxxqtlib1"]
unsafe extern "C++" {
#[doc(hidden)]
#[rust_name = "qqmlapplicationengine_new"]
fn qqmlapplicationengineNew() -> UniquePtr<QQmlApplicationEngine>;
}
// QQmlApplicationEngine is not a trivial to CXX and is not relocatable in Qt
// as the following fails in C++. So we cannot mark it as a trivial type
// and need to use references or pointers.
// static_assert(QTypeInfo<QQmlApplicationEngine>::isRelocatable);
impl UniquePtr<QQmlApplicationEngine> {}
}
pub use ffi::QQmlApplicationEngine;
impl QQmlApplicationEngine {
/// Create a new QQmlApplicationEngine
pub fn new() -> cxx::UniquePtr<Self> {
ffi::qqmlapplicationengine_new()
}
}