Details
-
Bug
-
Resolution: Won't Do
-
P0: Blocker
-
None
-
5.15.0
-
None
Description
As right now it is not possible to define the DBus type of custom types as the basic DBus types.
This is extremely problematic especially treating enums and QList<QString> or other custom types which may collide with QtDBus predefined types.
Imagine the following pseudo-code:
enum Type { E1 = 0, E2 = 1, E3 = 2 }; qDBusRegisterMetaType<Type>(); inline const QDBusArgument& operator<<(const QDBusArgument &argument, Type &source) { argument << static_const<int> source; return argument; } inline const QDBusArgument& operator<<(const QDBusArgument &argument, Type &source) { int tmp; argument >> tmp; source = static_const<Type> tmp; return argument; }
This snippet cause segmentation fault in dbus lib since the no signature is generated for the type with following warning from Qt.
QDBusMarshaller: type `Type' attempts to redefine basic D-BUS type 'i' (int) (Did you forget to call beginStructure() ?)
I think it should be perfectly fine to be able to do the above code. The same about other types which one may want to reuse the basic DBus types to represent.