Qt Code:
  1. class TrainNavigation:public QWidget
  2. {
  3. ...
  4. private:
  5. QPushButton *recordButton;
  6.  
  7. public slots:void setDisableSlot();
  8.  
  9. signals:
  10. void recordClicked();
  11. ..
  12. };
  13.  
  14. void TrainNavigation::setDisable()
  15. {
  16. emit recordClicked();
  17. }
  18. void TrainNavigation::setDisableSlot()
  19. {
  20. if()
  21. recordButton->setDisabled(TRUE);
  22. }
  23. }
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. #include "TrainNavigation.h"
  2. class TrainingUI:public QWidget
  3. {
  4. Q_OBJECT
  5. public:
  6. TrainNavigation *navigate;
  7.  
  8. TrainingUI();
  9. virtual ~TrainingUI();
  10. };
  11. TrainingUI::TrainingUI()
  12. {
  13. navigate = new TrainNavigation(this);
  14. connect(navigate,SIGNAL(recordClicked()),navigate,SLOT(setDisableSlot()));
  15. navigate->setDisable();
  16. }
To copy to clipboard, switch view to plain text mode 

In the above code i was thinking that some how i should tell in the if condition in my
TrainNavigation::setDisableSlot() function that if a button is clicked then only emit the signal..
i am doing all this because i dont want to expose my button to the higher level class that is TrainingUI class..