535 views
in GUI Development by
We have lots of setting values (>200) that need to shown at different views(menu or status page). As you know, the properties can implement it, but it need add the same number of properties and set/get is also need to add. The source will be very large.

Can I store them at an array and when the array's values is changed, all the views will be notifiied & updated?

1 Answer

0 votes
by
 
Best answer

Of course, you can store your data within an array and access it via index or via a method. And you can place this array within a device class to send a notification to observers, each time the content within the array has changed.

In this case you can use the object observers. Your UI components can then implement a slot method to update the content.

Nevertheless, the usage of single properties has some advantages compared to data arrays:

  • If you are using single properties, you can access them by name (e.g. 'Volume', 'Speed', 'Temperature',...) instead of an index (e.g. Data[15], Data[21],...).
  • If you are using single properties, you can use the observer infrastructure to update UI components (widgets) automatically via their 'Outlet'.
  • If you are using single properties, only the affected UI components will be updated - in case of one big data array, all UI components have to be updated every time one item within the array has changed.

 

by
The implement by the properties is simpler than an array. But if the properties is more than 200, the source of properties became ugly because set/get method of every proproty should be added  for the communication between gui and devices. So an array can be used  to reduce this implement. But as you said, the performance by array will be very bad for updating.

Is there a ’find’ method to find the properties of the object by the id or something else? So we can use it by the other way.

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...