Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. No matching member function to call for 'connect' | QEventLoop

No matching member function to call for 'connect' | QEventLoop

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 210 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sloppy-1-1
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved