Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.5.3, 6.6.3
-
None
Description
When declaring a `class` in a `rep` file, you can use `MODEL` to declare a property that returns a QAIM model pointer, and `CLASS` for a property that returns another QObject-derived type. Both types act like `PROP` with the `SOURCEONLYSETTER` flag.
That is inconvenient, as there may not be a setter. The instance can be just be created internally or be passed in via the constructor, and no setter function is wanted. Unfortunately, you are forced to create one, as a pure virtual declaration is created for you in the generated headers. Because you force the user to create a method that does nothing and clutter the API to suggest it can be set, I consider this a bug.
Expected:
Allow the developer to specify if there is a setter or not. I suggest accepting `CONSTANT`, `READONLY` and `SOURCEONLYSETTER` at least. For backwards compatibility, I guess the default would have to be `SOURCEONLYSETTER` initially.
Ideal:
Ideally, the default would become `CONSTANT` though, as that is the most often used property type for these kinds of properties. Perhaps that can be achieved via
1. Adding a switch you can set from the CMakeLists.txt file to choose the old (default is `SOURCEONLYSETTER`) or the new (default is `CONSTANT`) behavior, and
2. If you do not specify the switch, warn about the use of `CLASS` and `MODEL` keywords in .rep files where you do not specify one of the supported property types.
This would be more of less analogous to the way the resource path for qt_add_qml_module is dealt with.