Closed
Description
Discussed in #1032
Originally posted by SanderVocke August 13, 2024
Hi there,
I'm finding that cxx-qt does not seem to allow defining a bridge module that does not have a #[qobject]
-type in it. The reason seems to be that automoc is run on the resulting C++ files, and they error out when there are no Q_OBJECT types in the headers. For this reason, I am having to add dummy QObject types to all the bridge modules that I am making with e.g. some trivial types in them.
Am I missing something?
Example:
#[cxx_qt::bridge(cxx_file_stem = "shoop_rust_callable")]
pub mod ffi {
unsafe extern "C++" {
include!("cxx-qt-lib/qvariant.h");
type QVariant = cxx_qt_lib::QVariant;
}
unsafe extern "C++" {
include!("cxx-qt-shoop/shoop_rust_callable.h");
type ShoopRustCallable = type_shoop_rust_callable::ShoopRustCallableRust;
#[rust_name = "qvariant_can_convert_shoop_rust_callable"]
fn qvariantCanConvertShoopRustCallable(variant: &QVariant) -> bool;
#[rust_name = "register_metatype_shoop_rust_callable"]
fn registerMetatypeShoopRustCallable(name : &mut String);
}
#[namespace = "rust::cxxqtlib1::qvariant"]
unsafe extern "C++" {
include!("cxx-qt-lib/qvariant.h");
#[rust_name = "qvariant_construct_shoop_rust_callable"]
fn qvariantConstruct(value: &ShoopRustCallable) -> QVariant;
#[rust_name = "qvariant_value_or_default_shoop_rust_callable"]
fn qvariantValueOrDefault(variant: &QVariant) -> ShoopRustCallable;
}
extern "RustQt" {
#[qobject]
type Dummy= super::DummyRust;
}
}
use ffi::*;
#[derive(Default)]
pub struct DummyRust {}
(...)
This works, but fails as soon as the Dummy
and DummyRust
types are removed.
Metadata
Metadata
Assignees
Type
Projects
Status
Done