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. Connect to function
Forum Updated to NodeBB v4.3 + New Features

Connect to function

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 500 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.
  • A Offline
    A Offline
    Armin
    wrote on 10 Jan 2017, 11:14 last edited by p3c0 1 Oct 2017, 11:19
    #1

    Hi
    you see code:

    In class MainWindow:

    void replyFinished(QNetworkReply *reply);
    

    In void MainWindow::on_pushButton_clicked() :

    connect(manager , SIGNAL(finished(QNetworkReply*)) , this , SLOT(replyFinished(QNetworkReply*)));
    

    In .cpp file :

    void MainWindow::replyFinished(QNetworkReply *reply)
    

    and don't work and i get message in Application Output:
    QObject::connect: No such slot MainWindow::replyFinished(QNetworkReply*) in ..\DownloadManager\mainwindow.cpp:21
    QObject::connect: (receiver name: 'MainWindow')

    Why ?
    Thanks

    R 1 Reply Last reply 10 Jan 2017, 11:15
    0
    • A Armin
      10 Jan 2017, 11:14

      Hi
      you see code:

      In class MainWindow:

      void replyFinished(QNetworkReply *reply);
      

      In void MainWindow::on_pushButton_clicked() :

      connect(manager , SIGNAL(finished(QNetworkReply*)) , this , SLOT(replyFinished(QNetworkReply*)));
      

      In .cpp file :

      void MainWindow::replyFinished(QNetworkReply *reply)
      

      and don't work and i get message in Application Output:
      QObject::connect: No such slot MainWindow::replyFinished(QNetworkReply*) in ..\DownloadManager\mainwindow.cpp:21
      QObject::connect: (receiver name: 'MainWindow')

      Why ?
      Thanks

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 10 Jan 2017, 11:15 last edited by raven-worx 1 Oct 2017, 11:23
      #2

      @Armin said in Connect to function:

      QObject::connect: No such slot MainWindow::replyFinished(QNetworkReply*) in ..\DownloadManager\mainwindow.cpp:21

      make sure you define it as slot in your .h file.

      protected slots:
             void replyFinished(QNetworkReply *reply);
      

      Alternatively you can use the new Qt5 syntax using function pointers (then it's not necessary to declare it as slot):

      connect(manager , &QNetworkAccessManager::finished, this, &MainWindow::replyFinished);
      

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      7

      1/2

      10 Jan 2017, 11:14

      • Login

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