File tree Expand file tree Collapse file tree 3 files changed +13
-14
lines changed Expand file tree Collapse file tree 3 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -733,6 +733,10 @@ impl CxxQtBuilder {
733733 {
734734
735735 let mut moc_arguments = moc_arguments. clone ( ) ;
736+ // Ensure that header root is in the include path of moc
737+ // otherwise it cannot read the .cxx.h paths
738+ moc_arguments = moc_arguments. include_path ( dir:: header_root ( ) ) ;
739+
736740 if let Some ( qml_module) = & self . qml_module {
737741 // Ensure that the generated QObject header is in the include path
738742 // so that qmltyperegistar can include them later
Original file line number Diff line number Diff line change @@ -62,11 +62,9 @@ impl GeneratedCppQObjectBlocks {
6262
6363 pub fn from ( qobject : & ParsedQObject ) -> GeneratedCppQObjectBlocks {
6464 let mut qml_specifiers = Vec :: new ( ) ;
65- let mut includes = BTreeSet :: new ( ) ;
6665 if let Some ( qml_metadata) = & qobject. qml_metadata {
67- // When specifying the QML declarative macros moc needs the header to be
68- // included, otherwise it does not understand what these expand to.
69- includes. insert ( "#include <QtQml/QQmlEngine>" . to_string ( ) ) ;
66+ // Note ensure that the header moc processes has QtQml/QQmlEngine
67+ // this is done via generator/rust/qobject
7068
7169 qml_specifiers. push ( format ! ( "QML_NAMED_ELEMENT({})" , qml_metadata. name) ) ;
7270
@@ -79,7 +77,6 @@ impl GeneratedCppQObjectBlocks {
7977 }
8078 }
8179 GeneratedCppQObjectBlocks {
82- includes,
8380 metaobjects : qml_specifiers,
8481 ..Default :: default ( )
8582 }
Original file line number Diff line number Diff line change @@ -40,15 +40,13 @@ impl GeneratedRustFragment {
4040 generate_rust_signals( & structured_qobject. signals, & qobject_names, type_names) ?,
4141 ] ;
4242
43- // If this type is a singleton then we need to add an include
44- if let Some ( qml_metadata) = & qobject. qml_metadata {
45- if qml_metadata. singleton {
46- generated. push ( GeneratedRustFragment :: from_cxx_item ( parse_quote ! {
47- unsafe extern "C++" {
48- include!( <QtQml /QQmlEngine >) ;
49- }
50- } ) )
51- }
43+ // If this type is using QML declarative macros then ensure we have the right include
44+ if qobject. qml_metadata . is_some ( ) {
45+ generated. push ( GeneratedRustFragment :: from_cxx_item ( parse_quote ! {
46+ unsafe extern "C++" {
47+ include!( <QtQml /QQmlEngine >) ;
48+ }
49+ } ) )
5250 }
5351
5452 // If this type has threading enabled then add generation
You can’t perform that action at this time.
0 commit comments