[LAD] GUI mechanics question: interaction between UI control and data

Jeanette C. julien at mail.upb.de
Tue May 24 23:40:49 CEST 2022


Hey hey,
if a simple - possibly outdated - documentation can help, I'd be happy about 
any pointer. Current GTK+ and QT documentation comes with far too much 
overhead, even in the "trivial" basic apps.

Consider this: An application with a toggle button (on/off), some load from 
file button and a class holding one bvoolean value connect to the on/off 
button. The class could look like this:
class Data
{
   public:
     Data(bool value): its_value(value) {}
 	 ~Data() {}
 	 void set(bool value) { its_value = value; }
 	 bool get() const { return its_value; }
   private:
     bool its_value;
};

The button is connected to a Data object, via a signal, so its set(bool)
function is called.

The load function will load a value from a file.

How would you normally reflect that on GUI? What's the method to not
only set the Data object value, but also the corresponding button state?
What's the current practise to make this two-way connection? Combine
both button and object in a wrapper? Have some other kind of signal?
Simple change button state in every place the Data object is changed?

As stated above: even an old resource or documentation for a limited UI
library will do, as long as the method shines through with little
overhead and without anything like QML or a UI builder.

Best wishes and thanks for any help,

Jeanette

-- 
  * Website: http://juliencoder.de - for summer is a state of sound
  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
  * Audiobombs: https://www.audiobombs.com/users/jeanette_c
  * GitHub: https://github.com/jeanette-c

Make all the clouds disappear
Put all your fears to rest <3
(Britney Spears)


More information about the Linux-audio-dev mailing list