How do you put arguments in the slot that aren't on the signal?



  • It's the task of a separate flow to cause another class slot.

    MakePost *SendPost = new MakePost (); 
    

    QThread *PostThread = new QThread;
    SendPost->moveToThread(PostThread);

    connect(PostThread, SIGNAL(started()), MakePost, SLOT(MakePostSignal ("GetSett", "/test.php", "test=1")));

    PostThread->start();

    and I get a mistake:

    QObject:connect: No such slot MakePost:
    "/test.php, "test=1"

    although MakePost.h is

    public slots:
    void MakePostSignal(QString, QString, QByteArray);

    Tell me what I'm doing not how to put the values in the slot? Thank you.



  • If you have Qt5, you can do the following:

    MakePost *SendPost = new MakePost ();
    QThread *PostThread = new QThread;
    SendPost->moveToThread(PostThread);
    connect(PostThread, &QThread::started, MakePost, [MakePost]
    {
        MakePost->MakePostSignal("GetSett", "/test.php", "test=1");
    });
    PostThread->start();
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2