So I'm trying to have my slot emit a signal but I am getting the error " C2065 emit undeclared identifier." I think I have all the includes I need. I'm probably just doing something stupid, here is my code:
{
Q_OBJECT
.....
Q_SIGNALS:
void validFile();
public Q_SLOTS:
void enterFile();
void getDates();
void slotButtonLoads();
};
...
connect(push, SIGNAL(clicked()), this, SLOT(enterFile()));
connect(push, SIGNAL(validFile()),this, SLOT(getDates())); ///also I don't know what my sender should be for this new signal, 'push' is probably not right
}
void MyWidget::enterFile()
{
QString textEntered
= lineedit
->text
();
FileName = qstrdup( textEntered.toLatin1() );
if (fopen (FileName, "rb") == NULL){
emit validFile();
}else{
//something } //// a third question.. how can I allow the user to try again with the filename. I don't think I should
////// push->disconnect() because it will break my connection
}
class MyWidget : public QWidget
{
Q_OBJECT
.....
Q_SIGNALS:
void validFile();
public Q_SLOTS:
void enterFile();
void getDates();
void slotButtonLoads();
};
MyWidget::MyWidget(QWidget * parent):QWidget(parent){
...
push = new QPushButton("Plot", this);
connect(push, SIGNAL(clicked()), this, SLOT(enterFile()));
connect(push, SIGNAL(validFile()),this, SLOT(getDates())); ///also I don't know what my sender should be for this new signal, 'push' is probably not right
}
void MyWidget::enterFile()
{
QString textEntered = lineedit->text();
FileName = qstrdup( textEntered.toLatin1() );
if (fopen (FileName, "rb") == NULL){
emit validFile();
}else{
//something } //// a third question.. how can I allow the user to try again with the filename. I don't think I should
////// push->disconnect() because it will break my connection
}
To copy to clipboard, switch view to plain text mode
Thanks for all the help
Bookmarks