forked from KDAB/cxx-qt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6a7944c
commit f087752
Showing
16 changed files
with
173 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ repository.workspace = true | |
[features] | ||
default = [] | ||
qt_gui = [] | ||
qt_qml = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// clang-format off | ||
// SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
// clang-format on | ||
// SPDX-FileContributor: Andrew Hayzen <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
#pragma once | ||
|
||
#ifdef CXX_QT_QML_FEATURE | ||
|
||
#include <memory> | ||
|
||
#include <QtQml/QQmlEngine> | ||
|
||
namespace rust { | ||
namespace cxxqtlib1 { | ||
|
||
::std::unique_ptr<QQmlEngine> | ||
qqmlengineNew(); | ||
|
||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
// SPDX-FileContributor: Andrew Hayzen <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
mod qqmlengine; | ||
pub use qqmlengine::QQmlEngine; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// clang-format off | ||
// SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
// clang-format on | ||
// SPDX-FileContributor: Andrew Hayzen <[email protected]> | ||
// | ||
// SPDX-License-Identifier: MIT OR Apache-2.0 | ||
|
||
#ifdef CXX_QT_GUI_FEATURE | ||
#include "cxx-qt-lib/qqmlengine.h" | ||
|
||
namespace rust { | ||
namespace cxxqtlib1 { | ||
|
||
::std::unique_ptr<QQmlEngine> | ||
qqmlengineNew() | ||
{ | ||
return ::std::make_unique<QQmlEngine>(); | ||
} | ||
|
||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// SPDX-FileCopyrightText: 2023 Klarälvdalens Datakonsult AB, a KDAB Group company <[email protected]> | ||
// SPDX-FileContributor: Andrew Hayzen <[email protected]> | ||
// | ||
// 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/qqmlengine.h"); | ||
type QQmlEngine; | ||
|
||
/// 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 QQmlEngine>, 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 QQmlEngine>, 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: &QQmlEngine) -> 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: &QQmlEngine) -> QStringList; | ||
|
||
/// 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: &QQmlEngine) -> QStringList; | ||
|
||
/// Set the base URL for this engine to url. | ||
#[rust_name = "set_base_url"] | ||
fn setBaseUrl(self: Pin<&mut QQmlEngine>, 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 QQmlEngine>, 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 QQmlEngine>, paths: &QStringList); | ||
} | ||
|
||
#[namespace = "rust::cxxqtlib1"] | ||
unsafe extern "C++" { | ||
#[doc(hidden)] | ||
#[rust_name = "qqmlengine_new"] | ||
fn qqmlengineNew() -> UniquePtr<QQmlEngine>; | ||
} | ||
|
||
impl UniquePtr<QQmlEngine> {} | ||
} | ||
|
||
pub use ffi::QQmlEngine; | ||
|
||
impl QQmlEngine { | ||
/// Create a new QQmlEngine | ||
pub fn new() -> cxx::UniquePtr<Self> { | ||
ffi::qqmlengine_new() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters