As per #942 , an associated QEnum inherits its namespace from the QObject it is associated to.
However, we're uncertain if this is indeed the right way to go.
In contrast to Qt, we generate the QEnum, as an entirely independent type from the QObject, which is just re-exported within the QObject class.
So we could allow the user to set their own namespace for the QEnum.
This could even be very useful if the QObject doesn't have a namespace, but we don't want to add the QEnum to the global namespace.
e.g.
#[cxx_qt::bridge]
mod qobject {
#[qenum(MyObject)]
#[namespace="my_object"]
enum MyEnum { A, B };
extern "Rust" {
#[qobject]
type MyEnum = super::MyEnumRust;
}
}
Which would result in the types:
::MyObject, ::my_object::MyEnum, ::MyObject::MyEnum.
Especially when you have multiple enums for a single class, it could make sense to move all of the associated enums into a shared namespace, like we have with the CustomBaseClass in the qml_features example.
As per #942 , an associated QEnum inherits its namespace from the QObject it is associated to.
However, we're uncertain if this is indeed the right way to go. In contrast to Qt, we generate the QEnum, as an entirely independent type from the QObject, which is just re-exported within the QObject class.
So we could allow the user to set their own namespace for the QEnum. This could even be very useful if the QObject doesn't have a namespace, but we don't want to add the QEnum to the global namespace.
e.g.
Which would result in the types:
::MyObject
,::my_object::MyEnum
,::MyObject::MyEnum
.Especially when you have multiple enums for a single class, it could make sense to move all of the associated enums into a shared namespace, like we have with the
CustomBaseClass
in the qml_features example.