A couple relevant links regarding signals and slots:
Reimplementing moc as a Clang plugin
Verdigris, a header-only C++ library for near-zero-cost abstractions that were historically provided by moc
I strongly suspect that, by a combination of the two (and using macros 1.1 to implement a custom #[derive]), you could do something like this:
#[derive(QtMoc)]
trait Foo {
#[slot] fn frob(&mut self, x: u32);
#[signal] fn was_frobbed(&self) -> u32;
}
So for example, you could have the #[derive] generate a const trait method (corresponding to the constexpr function in Verdigris for the same purpose) that generates the QMetaObject.
As this actually is a good example of using Macros 1.1 in a way that would need to add items within the item being modified, I hope you don’t mind if I link to this from the relevant ticket on the Rust repo.
(Also, if done this way, supertraits could possibly take on some of the roles Qt uses inheritance for? Unsure.)