[beginner] Displaying data from a class C++
- 
Hi all, 
 I'm trying to create a program that displays live data from a Myo armband. I have a class DataCollector that inherits from QObject and myo::DeviceListener which collects information from the band and updates some int variables, I then just want these variables to be displayed by separate LCDNumber components in a class GUItest that inherits from QMainWindow.What is the best way about this to go about this? I think I'm getting confused with the signals and slots. // This is a snippet of my code: public: 
 int value() const { return emgMax; }public slots: 
 void setMaxValue(int value)
 {
 if (value != emgMax){
 emgMax = value;
 emit valueChanged(value);
 }
 }signals: 
 void valueChanged(int newValue);private: 
 int emgMax;// this is the connection 
 connect(&collector, &DataCollector::valueChanged, ui.lcdMax, SLOT(display(int)));// this is the call within dataCollector 
 if (emgSum > emgMax)
 {
 setMaxValue(emgSum);
 }
- 
Hi and welcome to devnet, // this looks wrong connect(&collector, &DataCollector::valueChanged, ui.lcdMax, SLOT(display(int)));connect(&collector, &DataCollector::valueChanged, ui.lcdMax, static_cast<void (QLCDNumber::*)(int)>(&QLCDNumber::display));However are you sure that collector lives long enough ? 
- 
Thank you for your response. The compiler likes your connect statement. But yes, I am now unsure about the collector's life. I have the collector as an uninitialized attribute in the class GUItest then in the constructor I handle the connection. Where is the program flow after "return a.exec();" is reached? is there away I can just have a loop and update the lcd displays every second? As the data being collected changes in the milliseconds 
- 
You can use a QTimer if you want to update at a fixed interval 
