I have a class A that inherits QWidget and class B that inherits QObject.
When a button is clicked, class A creates an object of Class B. Class B is supposed to perform a http request and emit a done signal to perform the slot function.
The problem is that class B can initialize properly but it cannot execute the slot function when the done signal is emitted. As far as I know, I don't see debug errors and my actual code is a bit too long.
Example:
	
	- { 
-     Q_OBJECT 
-     public: 
-         A(); 
-     private slots; 
-         void buttonClicked(); 
-     private: 
- }; 
        class A : public QWidget
{
    Q_OBJECT
    public:
        A();
    private slots;
        void buttonClicked();
    private:
        QPushButton *button;
};
To copy to clipboard, switch view to plain text mode 
  
	
	- { 
-      Q_OBJECT 
-      public: 
-          B(); 
-      private slots; 
-          void performFunction(); 
- }; 
        class B : public QObject
{
     Q_OBJECT
     public:
         B();
     private slots;
         void performFunction();
};
To copy to clipboard, switch view to plain text mode 
  
	
	- A::A() 
- { 
-      ... 
-      connect(button,SIGNAL(clicked()),this,SLOT(buttonClicked())); 
-   
- void A::buttonClicked() 
- { 
-    B objectB; 
- } 
        A::A()
{
     ...
     connect(button,SIGNAL(clicked()),this,SLOT(buttonClicked()));
void A::buttonClicked()
{
   B objectB;
}
To copy to clipboard, switch view to plain text mode 
  
	
	- B::B() 
- { 
-      ... 
-      connect(http,SIGNAL(done(bool)),this,SLOT(performFunction())); 
- } 
        B::B()
{
     ...
     connect(http,SIGNAL(done(bool)),this,SLOT(performFunction()));
}
To copy to clipboard, switch view to plain text mode 
  
Could anyone point out what I have done wrong.
				
			
Bookmarks