hasselmm / hasselmm/PropertyExperiment
Allow custom property methods
- Dominant language
- C++
- Stars
- 4
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Defacto this only implements member properties so far:
``` C++
Q_PROPERTY(int name MEMBER name NOTIFY nameChanged)
```
This is convenient and useful for 60%, maybe 80% of all cases. Still it's neccessary to also allow custom property methods for a full replacement of moc. Maybe with a syntax like this:
``` C++
N_PROPERTY(int, customReader) = {&NObjectMacro::customInt};
N_PROPERTY(double, customWriter) = {reset = &NObjectMacro::resetCustomDouble
writer = &NObjectMacro::setCustomDouble,
reader = &NObjectMacro::customDuble,
initial = 42};
```
Maybe better maybe even this is possible, as this would avoid storing the custom methods in instance variables:
``` C++
N_PROPERTY(int, customReader, &NObjectMacro::customInt) = 100;
N_PROPERTY(double, customWriter, reset = &NObjectMacro::resetCustomDouble
writer = &NObjectMacro::setCustomDouble,
reader = &NObjectMacro::customDuble) = 4.2;
```
The mechanism for named arguments would be something like this:
``` C++
inline constexpr PropertyArgument reset;
template
class Property { ... };
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.