Skip to content

Commit 5d1d996

Browse files
committed
cxx-qt-gen: use cxx-qt connectiontype and qmetaobjectconnection
1 parent b682412 commit 5d1d996

File tree

16 files changed

+184
-212
lines changed

16 files changed

+184
-212
lines changed

crates/cxx-qt-gen/src/generator/rust/property/mod.rs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,7 @@ mod tests {
320320
#[doc = "Connect the given function pointer to the signal "]
321321
#[doc = "trivialPropertyChanged"]
322322
#[doc = ", so that when the signal is emitted the function pointer is executed."]
323-
#[must_use]
324-
pub fn connect_trivial_property_changed<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt_lib::ConnectionType) -> cxx_qt_lib::QMetaObjectConnection
323+
pub fn connect_trivial_property_changed<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnection
325324
{
326325
ffi::MyObject_connect_trivial_property_changed(
327326
self,
@@ -341,13 +340,12 @@ mod tests {
341340
#[doc = ", so that when the signal is emitted the function pointer is executed."]
342341
#[doc = "\n"]
343342
#[doc = "Note that this method uses a AutoConnection connection type."]
344-
#[must_use]
345-
pub fn on_trivial_property_changed<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt_lib::QMetaObjectConnection
343+
pub fn on_trivial_property_changed<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnection
346344
{
347345
ffi::MyObject_connect_trivial_property_changed(
348346
self,
349347
cxx_qt::signalhandler::CxxQtSignalHandler::<MyObjectCxxQtSignalClosuretrivialPropertyChanged>::new(Box::new(closure)),
350-
cxx_qt_lib::ConnectionType::AutoConnection,
348+
cxx_qt::ConnectionType::AutoConnection,
351349
)
352350
}
353351
}
@@ -448,8 +446,7 @@ mod tests {
448446
#[doc = "Connect the given function pointer to the signal "]
449447
#[doc = "opaquePropertyChanged"]
450448
#[doc = ", so that when the signal is emitted the function pointer is executed."]
451-
#[must_use]
452-
pub fn connect_opaque_property_changed<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt_lib::ConnectionType) -> cxx_qt_lib::QMetaObjectConnection
449+
pub fn connect_opaque_property_changed<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnection
453450
{
454451
ffi::MyObject_connect_opaque_property_changed(
455452
self,
@@ -469,13 +466,12 @@ mod tests {
469466
#[doc = ", so that when the signal is emitted the function pointer is executed."]
470467
#[doc = "\n"]
471468
#[doc = "Note that this method uses a AutoConnection connection type."]
472-
#[must_use]
473-
pub fn on_opaque_property_changed<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt_lib::QMetaObjectConnection
469+
pub fn on_opaque_property_changed<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnection
474470
{
475471
ffi::MyObject_connect_opaque_property_changed(
476472
self,
477473
cxx_qt::signalhandler::CxxQtSignalHandler::<MyObjectCxxQtSignalClosureopaquePropertyChanged>::new(Box::new(closure)),
478-
cxx_qt_lib::ConnectionType::AutoConnection,
474+
cxx_qt::ConnectionType::AutoConnection,
479475
)
480476
}
481477
}
@@ -576,8 +572,7 @@ mod tests {
576572
#[doc = "Connect the given function pointer to the signal "]
577573
#[doc = "unsafePropertyChanged"]
578574
#[doc = ", so that when the signal is emitted the function pointer is executed."]
579-
#[must_use]
580-
pub fn connect_unsafe_property_changed<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt_lib::ConnectionType) -> cxx_qt_lib::QMetaObjectConnection
575+
pub fn connect_unsafe_property_changed<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnection
581576
{
582577
ffi::MyObject_connect_unsafe_property_changed(
583578
self,
@@ -597,13 +592,12 @@ mod tests {
597592
#[doc = ", so that when the signal is emitted the function pointer is executed."]
598593
#[doc = "\n"]
599594
#[doc = "Note that this method uses a AutoConnection connection type."]
600-
#[must_use]
601-
pub fn on_unsafe_property_changed<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt_lib::QMetaObjectConnection
595+
pub fn on_unsafe_property_changed<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnection
602596
{
603597
ffi::MyObject_connect_unsafe_property_changed(
604598
self,
605599
cxx_qt::signalhandler::CxxQtSignalHandler::<MyObjectCxxQtSignalClosureunsafePropertyChanged>::new(Box::new(closure)),
606-
cxx_qt_lib::ConnectionType::AutoConnection,
600+
cxx_qt::ConnectionType::AutoConnection,
607601
)
608602
}
609603
}

crates/cxx-qt-gen/src/generator/rust/signals.rs

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ pub fn generate_rust_signal(
140140
#[doc = "Connect the given function pointer to the signal "]
141141
#[doc = #signal_name_cpp_str]
142142
#[doc = ", so that when the signal is emitted the function pointer is executed."]
143-
#[must_use]
144-
pub fn #connect_ident_rust<F: FnMut(#self_type_qualified, #(#parameters_qualified_type),*) + 'static>(self: #self_type_qualified, mut closure: F, conn_type: cxx_qt_lib::ConnectionType) -> cxx_qt_lib::QMetaObjectConnection
143+
pub fn #connect_ident_rust<F: FnMut(#self_type_qualified, #(#parameters_qualified_type),*) + 'static>(self: #self_type_qualified, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnection
145144
{
146145
#module_ident::#free_connect_ident_rust(
147146
self,
@@ -158,13 +157,12 @@ pub fn generate_rust_signal(
158157
#[doc = ", so that when the signal is emitted the function pointer is executed."]
159158
#[doc = "\n"]
160159
#[doc = "Note that this method uses a AutoConnection connection type."]
161-
#[must_use]
162-
pub fn #on_ident_rust<F: FnMut(#self_type_qualified, #(#parameters_qualified_type),*) + 'static>(self: #self_type_qualified, mut closure: F) -> cxx_qt_lib::QMetaObjectConnection
160+
pub fn #on_ident_rust<F: FnMut(#self_type_qualified, #(#parameters_qualified_type),*) + 'static>(self: #self_type_qualified, mut closure: F) -> cxx_qt::QMetaObjectConnection
163161
{
164162
#module_ident::#free_connect_ident_rust(
165163
self,
166164
cxx_qt::signalhandler::CxxQtSignalHandler::<#closure_struct>::new(Box::new(closure)),
167-
cxx_qt_lib::ConnectionType::AutoConnection,
165+
cxx_qt::ConnectionType::AutoConnection,
168166
)
169167
}
170168
}
@@ -337,8 +335,7 @@ mod tests {
337335
#[doc = "Connect the given function pointer to the signal "]
338336
#[doc = "ready"]
339337
#[doc = ", so that when the signal is emitted the function pointer is executed."]
340-
#[must_use]
341-
pub fn connect_ready<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt_lib::ConnectionType) -> cxx_qt_lib::QMetaObjectConnection
338+
pub fn connect_ready<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnection
342339
{
343340
ffi::MyObject_connect_ready(
344341
self,
@@ -358,13 +355,12 @@ mod tests {
358355
#[doc = ", so that when the signal is emitted the function pointer is executed."]
359356
#[doc = "\n"]
360357
#[doc = "Note that this method uses a AutoConnection connection type."]
361-
#[must_use]
362-
pub fn on_ready<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt_lib::QMetaObjectConnection
358+
pub fn on_ready<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnection
363359
{
364360
ffi::MyObject_connect_ready(
365361
self,
366362
cxx_qt::signalhandler::CxxQtSignalHandler::<MyObjectCxxQtSignalClosureready>::new(Box::new(closure)),
367-
cxx_qt_lib::ConnectionType::AutoConnection,
363+
cxx_qt::ConnectionType::AutoConnection,
368364
)
369365
}
370366
}
@@ -504,8 +500,7 @@ mod tests {
504500
#[doc = "Connect the given function pointer to the signal "]
505501
#[doc = "dataChanged"]
506502
#[doc = ", so that when the signal is emitted the function pointer is executed."]
507-
#[must_use]
508-
pub fn connect_data_changed<F: FnMut(core::pin::Pin<&mut MyObject>, i32, cxx::UniquePtr<QColor>) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt_lib::ConnectionType) -> cxx_qt_lib::QMetaObjectConnection
503+
pub fn connect_data_changed<F: FnMut(core::pin::Pin<&mut MyObject>, i32, cxx::UniquePtr<QColor>) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnection
509504
{
510505
ffi::MyObject_connect_data_changed(
511506
self,
@@ -525,13 +520,12 @@ mod tests {
525520
#[doc = ", so that when the signal is emitted the function pointer is executed."]
526521
#[doc = "\n"]
527522
#[doc = "Note that this method uses a AutoConnection connection type."]
528-
#[must_use]
529-
pub fn on_data_changed<F: FnMut(core::pin::Pin<&mut MyObject>, i32, cxx::UniquePtr<QColor>) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt_lib::QMetaObjectConnection
523+
pub fn on_data_changed<F: FnMut(core::pin::Pin<&mut MyObject>, i32, cxx::UniquePtr<QColor>) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnection
530524
{
531525
ffi::MyObject_connect_data_changed(
532526
self,
533527
cxx_qt::signalhandler::CxxQtSignalHandler::<MyObjectCxxQtSignalClosuredataChanged>::new(Box::new(closure)),
534-
cxx_qt_lib::ConnectionType::AutoConnection,
528+
cxx_qt::ConnectionType::AutoConnection,
535529
)
536530
}
537531
}
@@ -665,8 +659,7 @@ mod tests {
665659
#[doc = "Connect the given function pointer to the signal "]
666660
#[doc = "unsafeSignal"]
667661
#[doc = ", so that when the signal is emitted the function pointer is executed."]
668-
#[must_use]
669-
pub fn connect_unsafe_signal<F: FnMut(core::pin::Pin<&mut MyObject>, *mut T) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt_lib::ConnectionType) -> cxx_qt_lib::QMetaObjectConnection
662+
pub fn connect_unsafe_signal<F: FnMut(core::pin::Pin<&mut MyObject>, *mut T) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnection
670663
{
671664
ffi::MyObject_connect_unsafe_signal(
672665
self,
@@ -686,13 +679,12 @@ mod tests {
686679
#[doc = ", so that when the signal is emitted the function pointer is executed."]
687680
#[doc = "\n"]
688681
#[doc = "Note that this method uses a AutoConnection connection type."]
689-
#[must_use]
690-
pub fn on_unsafe_signal<F: FnMut(core::pin::Pin<&mut MyObject>, *mut T) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt_lib::QMetaObjectConnection
682+
pub fn on_unsafe_signal<F: FnMut(core::pin::Pin<&mut MyObject>, *mut T) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnection
691683
{
692684
ffi::MyObject_connect_unsafe_signal(
693685
self,
694686
cxx_qt::signalhandler::CxxQtSignalHandler::<MyObjectCxxQtSignalClosureunsafeSignal>::new(Box::new(closure)),
695-
cxx_qt_lib::ConnectionType::AutoConnection,
687+
cxx_qt::ConnectionType::AutoConnection,
696688
)
697689
}
698690
}
@@ -824,8 +816,7 @@ mod tests {
824816
#[doc = "Connect the given function pointer to the signal "]
825817
#[doc = "baseName"]
826818
#[doc = ", so that when the signal is emitted the function pointer is executed."]
827-
#[must_use]
828-
pub fn connect_existing_signal<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt_lib::ConnectionType) -> cxx_qt_lib::QMetaObjectConnection
819+
pub fn connect_existing_signal<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnection
829820
{
830821
ffi::MyObject_connect_existing_signal(
831822
self,
@@ -845,13 +836,12 @@ mod tests {
845836
#[doc = ", so that when the signal is emitted the function pointer is executed."]
846837
#[doc = "\n"]
847838
#[doc = "Note that this method uses a AutoConnection connection type."]
848-
#[must_use]
849-
pub fn on_existing_signal<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt_lib::QMetaObjectConnection
839+
pub fn on_existing_signal<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnection
850840
{
851841
ffi::MyObject_connect_existing_signal(
852842
self,
853843
cxx_qt::signalhandler::CxxQtSignalHandler::<MyObjectCxxQtSignalClosurebaseName>::new(Box::new(closure)),
854-
cxx_qt_lib::ConnectionType::AutoConnection,
844+
cxx_qt::ConnectionType::AutoConnection,
855845
)
856846
}
857847
}
@@ -978,8 +968,7 @@ mod tests {
978968
#[doc = "Connect the given function pointer to the signal "]
979969
#[doc = "ready"]
980970
#[doc = ", so that when the signal is emitted the function pointer is executed."]
981-
#[must_use]
982-
pub fn connect_ready<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt_lib::ConnectionType) -> cxx_qt_lib::QMetaObjectConnection
971+
pub fn connect_ready<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnection
983972
{
984973
ffi::MyObject_connect_ready(
985974
self,
@@ -999,13 +988,12 @@ mod tests {
999988
#[doc = ", so that when the signal is emitted the function pointer is executed."]
1000989
#[doc = "\n"]
1001990
#[doc = "Note that this method uses a AutoConnection connection type."]
1002-
#[must_use]
1003-
pub fn on_ready<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt_lib::QMetaObjectConnection
991+
pub fn on_ready<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnection
1004992
{
1005993
ffi::MyObject_connect_ready(
1006994
self,
1007995
cxx_qt::signalhandler::CxxQtSignalHandler::<MyObjectCxxQtSignalClosureready>::new(Box::new(closure)),
1008-
cxx_qt_lib::ConnectionType::AutoConnection,
996+
cxx_qt::ConnectionType::AutoConnection,
1009997
)
1010998
}
1011999
}
@@ -1124,8 +1112,7 @@ mod tests {
11241112
#[doc = "Connect the given function pointer to the signal "]
11251113
#[doc = "ready"]
11261114
#[doc = ", so that when the signal is emitted the function pointer is executed."]
1127-
#[must_use]
1128-
pub fn connect_ready<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt_lib::ConnectionType) -> cxx_qt_lib::QMetaObjectConnection
1115+
pub fn connect_ready<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F, conn_type: cxx_qt::ConnectionType) -> cxx_qt::QMetaObjectConnection
11291116
{
11301117
ffi::MyObject_connect_ready(
11311118
self,
@@ -1145,13 +1132,12 @@ mod tests {
11451132
#[doc = ", so that when the signal is emitted the function pointer is executed."]
11461133
#[doc = "\n"]
11471134
#[doc = "Note that this method uses a AutoConnection connection type."]
1148-
#[must_use]
1149-
pub fn on_ready<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt_lib::QMetaObjectConnection
1135+
pub fn on_ready<F: FnMut(core::pin::Pin<&mut MyObject>, ) + 'static>(self: core::pin::Pin<&mut MyObject>, mut closure: F) -> cxx_qt::QMetaObjectConnection
11501136
{
11511137
ffi::MyObject_connect_ready(
11521138
self,
11531139
cxx_qt::signalhandler::CxxQtSignalHandler::<MyObjectCxxQtSignalClosureready>::new(Box::new(closure)),
1154-
cxx_qt_lib::ConnectionType::AutoConnection,
1140+
cxx_qt::ConnectionType::AutoConnection,
11551141
)
11561142
}
11571143
}

0 commit comments

Comments
 (0)