Skip to content

Commit 4bf2676

Browse files
committed
WIP: cxx-qt-lib: use cxx_qt::bridge and #[qsignal]
1 parent 9309a94 commit 4bf2676

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

crates/cxx-qt-lib/src/qml/qqmlengine.rs

+14-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,21 @@
33
//
44
// SPDX-License-Identifier: MIT OR Apache-2.0
55

6-
#[cxx::bridge]
6+
#[cxx_qt::bridge(cxx_file_stem = "qqmlengine")]
77
mod ffi {
8+
unsafe extern "C++Qt" {
9+
include!("cxx-qt-lib/qqmlengine.h");
10+
type QQmlEngine;
11+
12+
/// 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.
13+
#[qsignal]
14+
fn exit(self: Pin<&mut QQmlEngine>, ret_code: i32);
15+
16+
/// This signal is emitted when the QML loaded by the engine would like to quit.
17+
#[qsignal]
18+
fn quit(self: Pin<&mut QQmlEngine>);
19+
}
20+
821
unsafe extern "C++" {
922
include!("cxx-qt-lib/qstring.h");
1023
type QString = crate::QString;
@@ -13,9 +26,6 @@ mod ffi {
1326
include!("cxx-qt-lib/qurl.h");
1427
type QUrl = crate::QUrl;
1528

16-
include!("cxx-qt-lib/qqmlengine.h");
17-
type QQmlEngine;
18-
1929
/// Adds path as a directory where the engine searches for installed modules in a URL-based directory structure.
2030
#[rust_name = "add_import_path"]
2131
fn addImportPath(self: Pin<&mut QQmlEngine>, path: &QString);

0 commit comments

Comments
 (0)