Unsolved Q_PROPERTY - write function for multiple property
-
Hello,
I have array of int variables.
This array I sync with other PC.I export value as property to show in QML:
Q_PROPERTY(int delay MEMBER delay NOTIFY delayChange ) Q_PROPERTY(int temp MEMBER temp NOTIFY tempChange )
It's work perfectly.
Now I need to, on some variable, be able to change value. So I append WRITE:Q_PROPERTY(int delay MEMBER delay WRITE delayWrite NOTIFY delayChange ) Q_PROPERTY(int temp MEMBER temp WRITE tempWrite NOTIFY tempChange )
It's working but in my implementaion Write function I call same function for all variable - changeVariable(int position, int value). Only change position -position is position in synced array.
So I need write lot of trivial function - Is any option how to do it? Some addicional argument to WRITE function?
Thank you
-
@poucz I would suggest, if you're using QtCreator:
Right click in Q_PROPERTY -> Refactor -> Generate Missing Q_PROPERTY members
I use it all the time. It won't work for your quite as well, as you have an array as underlying data structure.