Skip to content

Commit

Permalink
WIP: cxx-qt-lib: use cxx_qt::bridge and #[qsignal]
Browse files Browse the repository at this point in the history
  • Loading branch information
ahayzen-kdab committed Feb 12, 2024
1 parent 9309a94 commit 4bf2676
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions crates/cxx-qt-lib/src/qml/qqmlengine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,21 @@
//
// SPDX-License-Identifier: MIT OR Apache-2.0

#[cxx::bridge]
#[cxx_qt::bridge(cxx_file_stem = "qqmlengine")]
mod ffi {
unsafe extern "C++Qt" {
include!("cxx-qt-lib/qqmlengine.h");
type QQmlEngine;

/// 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.
#[qsignal]
fn exit(self: Pin<&mut QQmlEngine>, ret_code: i32);

/// This signal is emitted when the QML loaded by the engine would like to quit.
#[qsignal]
fn quit(self: Pin<&mut QQmlEngine>);
}

unsafe extern "C++" {
include!("cxx-qt-lib/qstring.h");
type QString = crate::QString;
Expand All @@ -13,9 +26,6 @@ mod ffi {
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);
Expand Down

0 comments on commit 4bf2676

Please sign in to comment.