Signal and slot problem
- 
but why are u creating a new Object??? 
 Use the one in/from main.That is the one you have connect to mains slots so making a new one 
 in that function will not send any signals to main as you do not connect it
 like the other one.So just newing the local copy instead, will not make any difference :) 
- 
but why are u creating a new Object??? 
 Use the one in/from main.That is the one you have connect to mains slots so making a new one 
 in that function will not send any signals to main as you do not connect it
 like the other one.So just newing the local copy instead, will not make any difference :) 
- 
I would expect void gpio::ISR() 
 {if(gpio::isHIGH()) { qDebug()<<"RISING Interrupt called"; emit_RisingSignal(); }No local object of same type! ? 
- 
but why are u creating a new Object??? 
 Use the one in/from main.That is the one you have connect to mains slots so making a new one 
 in that function will not send any signals to main as you do not connect it
 like the other one.So just newing the local copy instead, will not make any difference :) 
- 
Ok, if u create a instance for use with signals, then its fine. 
 You just need to connect this new object to the slots again.
- 
Ok, if u create a instance for use with signals, then its fine. 
 You just need to connect this new object to the slots again.
- 
@mrjj thanks but i'm pretty much beginner with signals and slots,where do i need to change my code 
- 
@azravian 
 Hi,
 void gpio::ISR()
 {
 gpio* GPIO=new gpio;
 // here u need to connect again
 // since its not pr type, but pr instance
 // so the connect u made in main, are not on GPIO here
- 
Hi, Just one thing, you have now a memory leak. But in any case, I must say I don't see any reason for making all these methods static. 
- 
Hi, Just one thing, you have now a memory leak. But in any case, I must say I don't see any reason for making all these methods static. 
- 
- 
Hi, Just one thing, you have now a memory leak. But in any case, I must say I don't see any reason for making all these methods static. 
- 
@SGaist thank you for it :) and the point od making these methods statics is that i am using wiringPi library which need a function as a parameter so i need make it static. @azravian In this case you could add a public static method to get the pointer to the gpio instance (basically you create a singleton): class gpio : public QObject { Q_OBJECT public: gpio(): instancePtr(nullptr) {} static gpio* instance() { if (!instancePtr) instancePtr = new gpio(); return instancePtr; } private: gpio* instancePtr;You can use this method in main to setup the connection and in static methods in gpio to get the pointer to the instance. Don't forget to delete the instance later. 
- 
@jsulm you forgot to also make instancePtr static. However, I don't think the singleton pattern should be applied here. 
- 
- 
Silly question but are you user the label is visible ? Do you have something on it before you call inserted ? 
- 
Silly question but are you user the label is visible ? Do you have something on it before you call inserted ? 
 
