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 513 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 last edited by p3c0
    #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

    raven-worxR 1 Reply Last reply
    0
    • A Armin

      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

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #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

      • Login

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