class TrainNavigation
:public QWidget{
...
private:
public slots:void setDisableSlot();
signals:
void recordClicked();
..
};
void TrainNavigation::setDisable()
{
emit recordClicked();
}
void TrainNavigation::setDisableSlot()
{
if()
recordButton->setDisabled(TRUE);
}
}
class TrainNavigation:public QWidget
{
...
private:
QPushButton *recordButton;
public slots:void setDisableSlot();
signals:
void recordClicked();
..
};
void TrainNavigation::setDisable()
{
emit recordClicked();
}
void TrainNavigation::setDisableSlot()
{
if()
recordButton->setDisabled(TRUE);
}
}
To copy to clipboard, switch view to plain text mode
#include "TrainNavigation.h"
{
Q_OBJECT
public:
TrainNavigation *navigate;
TrainingUI();
virtual ~TrainingUI();
};
TrainingUI::TrainingUI()
{
navigate = new TrainNavigation(this);
connect(navigate,SIGNAL(recordClicked()),navigate,SLOT(setDisableSlot()));
navigate->setDisable();
}
#include "TrainNavigation.h"
class TrainingUI:public QWidget
{
Q_OBJECT
public:
TrainNavigation *navigate;
TrainingUI();
virtual ~TrainingUI();
};
TrainingUI::TrainingUI()
{
navigate = new TrainNavigation(this);
connect(navigate,SIGNAL(recordClicked()),navigate,SLOT(setDisableSlot()));
navigate->setDisable();
}
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..
Bookmarks