No matching member function to call for 'connect' | QEventLoop
Unsolved
General and Desktop
-
Hi,
I get the following error when trying to use the connect function:No matching member function for call to 'connect'
The code looks like this:
QEventLoop loop; connect(OK(), SIGNAL(OK_Pressed()), &loop, SLOT(quit())); loop.exec();
The signal is generated in the following way:
void Main::OK() { emit OK_Pressed(); }
Basically I want to wait for a function to be called and completed (I call on OK() at the end of said function) without a while loop or a similar workaround.
I also have the methods and signals declared:
class Main : public QMainWindow { Q_OBJECT public: Main(QWidget *parent = nullptr); ~Main(); signals: void OK_Pressed(); private: Ui::Main *ui; void OK(); }
Hope I've provided enough information, this is my first time posting here.
-
Hi and welcome to devnet,
Your first parameter is wrong. Connect takes a pointer to a QObject, you pass it the return value of your OK method.