Is there a way to keep ui data synchronized with program data?
I have dozens of controls in my UI, and keeping the data synchronized between the UI and the program is getting to be a very big problem. Is there a way to say "synchronize text in all controls with the data in the C++ program"? If not, is there at least a way to organize this so that it doesn't take most of my development time to keep it working correctly?
As soon you find a way to associate any control with data it is easy,
I can do it for each control, but I have many controls and it is a real pain to keep them all synchronized. Is there a generic way to do it for all controls?
If you are using Qt Quick, you should wrap your program data each in a Q_PROPERTY and implement an intelligent notify signal indicating the data has changed. Then in your QML, just bind a control's value to a particular property exposed from C++.
I don't think I'm using Qt Quick. I'm pretty sure I'm not using QML.
My program is written using VS 2013 and I have the Qt plugin that runs the moc step.
Can I use Q_PROPERTY in this environment? Or if not, is it hard to switch to Qt Quick?
My current plan is to write some C++ classes, e.g., qtInt, qtFloat, that will automatically synchronize data from the C++ variable to the UI, and a code generator that will create a connect statement for each variable to synchronize the other way. Then I'll just use those classes in my program instead of int, float, etc. Does that sound like it will work?