QFileDialog accept() slot is not accessable
I am using an instance of QFileDialog so a user can search for a directory that meets a specific criteria. When the directory signature is recognised by my code, I want to use
Code:
emit fileDialog->accept();
I have declared this signal in the header file with
Code:
signals:
void accept ();
so the user does not have to press the OK button. This will save the user time traversing directories.
When I try to compile with this line, I get an error: 'virtual void QDialog::accept()' is protected
Why is this compilation error occuring when QFileDialog is a sub class of QDialog?.
What can I do to get this code to work?
Any suggestions will be greatly appreciated. Thanks
Re: QFileDialog accept() slot is not accessable
accept() is a slot, not a signal. Why don't you just call accept() from the dialog? Not as a signal but as a regular method.
Re: QFileDialog accept() slot is not accessable
I tried this but I get the same error: 'virtual void QDialog::accept()' is protected
Re: QFileDialog accept() slot is not accessable
Because it is protected in QFileDialog... You may only call it from within the dialog itself. You'll have to subclass QFileDialog and place your code there.
Re: QFileDialog accept() slot is not accessable
Thanks. It is obvious now you have pointed that out. I will give that a go while I still have hair