qt - C++ to QML - setting properties -


I have a QT (4.7.4) application, which is a graphic terminal for other applications. In QML, I have defined the scene with (name) controls. In C ++ I get commands from those applications which request to show a scene with the values ​​specified for my controls. When the command arrives, I Use something like

  myView = LoadTheNewViewIntoLoader (viewName); Q object * ctrl = myView-> FindChild & lt; QObject * & gt; (CtrlName); If (ctrl) {ctrl- & gt; Set property ("caption", new caption); }  

To update the control value (ie change text, image or whatever)

Question : How soon is any such action? Or: How can I ensure that all properties have been applied to the controls?

The problem is that in C ++ I create a sequence for loading the scene and for the operation of all the properties, but when there are many incoming commands during the stress test, I think that There is no time to broadcast values ​​from C ++ to QML and when I'm executing the next command, the previous action is still being executed. In such a situation, the control of the screen completely disappears for some time and sometimes I get segmentation fault. It is easy to get a more complex screen with a large number of controls.

Decrease your design / load handling for display.

Use of slots, signals

Controlling logic and QL to C ++, viewer

some my load load = NewViewIntoLoader (viewName);

  QObject * ctrl = myView-> FindChild & lt; QObject * & gt; (CtrlName); If (ctrl) {emit sgnShowcaption ("newCaption"); }  

Handle and set this signal in qml. Label = str (str will be in the signal you capture)


Comments