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. Slots not added in moc file

Slots not added in moc file

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 5 Posters 1.4k 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.
  • M Offline
    M Offline
    mahd96
    wrote on last edited by
    #1

    public slots:
    void timeout();
    void doError();
    void retryTimerTimeout();
    void replyReady(QByteArray array);

    the first three aren't added to moc file but last one works correctly!
    what might be the issue??

    class inherited from QObject
    macro is included .

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mahd96
      wrote on last edited by
      #11

      @mrjj @SGaist
      I solved the issue by reinstalling msvc2015

      I recently installed Visual Studio 2017 and i had visual studio2015 in my pc. i think the were some kind of incompibality there that cause this issue.
      i try to reset my windows and make a clean install of Visual studio(i need msvc compiler and windows kits) and it worked

      1 Reply Last reply
      1
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi
        It can be stale qmake cache.
        Try to delete build folder and do rebuild all.

        1 Reply Last reply
        2
        • M Offline
          M Offline
          mahd96
          wrote on last edited by
          #3

          i used clean build.
          then i manualy delete the build directory! it didnt work as well

          mrjjM 1 Reply Last reply
          0
          • M mahd96

            i used clean build.
            then i manualy delete the build directory! it didnt work as well

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @mahd96
            Ok, if you make a default GUI project, and paste those slots to mainwindow and
            their bodies to cpp. Is it still not included?
            It could choke on something but your slots seem perfectly normal.

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

              Hi,

              To add to @mrjj, can you post the complete class declaration ?

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

              M 1 Reply Last reply
              0
              • mrjjM mrjj

                @mahd96
                Ok, if you make a default GUI project, and paste those slots to mainwindow and
                their bodies to cpp. Is it still not included?
                It could choke on something but your slots seem perfectly normal.

                M Offline
                M Offline
                mahd96
                wrote on last edited by
                #6

                @mrjj
                no its not GUI project.
                every thing is fine with cpp an header file. Moc file is not being created correctly

                1 Reply Last reply
                0
                • SGaistS SGaist

                  Hi,

                  To add to @mrjj, can you post the complete class declaration ?

                  M Offline
                  M Offline
                  mahd96
                  wrote on last edited by
                  #7

                  @SGaist

                  QObject::connect(&networkHandler,SIGNAL(replyReady(QByteArray)),this,SLOT(replyReady(QByteArray)));
                  QObject::connect(&networkHandler,SIGNAL(error()),this,SLOT(doError()));
                  QObject::connect(&networkHandler,SIGNAL(timeout()),this,SLOT(timeout()));

                  retryTimer.setInterval(UploadRequest::RetryTimerInterval);
                  retryTimer.setSingleShot(true);
                  QObject::connect(&retryTimer,SIGNAL(timeout()),this,SLOT(retryTimerTimeout()));
                  

                  //#######################################################################################
                  void UploadExistApi::replyReady(QByteArray array)
                  {
                  qDebug() << "UploadExistApi::replyReady | replyData: " << array;
                  if(!processResult(array))
                  {
                  doError();
                  }
                  }
                  //#######################################################################################
                  void UploadExistApi::timeout()
                  {
                  qDebug() << "UploadExistApi::timeout";
                  currentRequest.setIsTimeOut(true);
                  doError();
                  }
                  //#######################################################################################
                  void UploadExistApi::retryTimerTimeout()
                  {
                  startFileExist(currentRequest);
                  }

                  //#######################################################################################
                  void UploadExistApi::doError()
                  {
                  if(currentRequest.getTries() >= UploadRequest::MaximumTriesCount)
                  {
                  qDebug() << "UploadExistApi::startFileExist | Maximum number of tries reached ";
                  currentFileInfo.clear();
                  currentRequest.clear();
                  emit error();
                  }
                  else
                  {
                  retryTimer.start();
                  }
                  }

                  1 Reply Last reply
                  0
                  • mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by mrjj
                    #8

                    Hi
                    Just to be sure, you are still having a QApplication
                    calling a.exec() somewhere ? (in main)
                    Also, can you post your .pro file ?

                    1 Reply Last reply
                    0
                    • Christian EhrlicherC Offline
                      Christian EhrlicherC Offline
                      Christian Ehrlicher
                      Lifetime Qt Champion
                      wrote on last edited by
                      #9

                      @mrjj said in Slots not added in moc file:

                      Also, can you post your .pro file ?

                      And you complete source/header also - where did you define your timer?

                      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                      Visit the Qt Academy at https://academy.qt.io/catalog

                      1 Reply Last reply
                      2
                      • dheerendraD Offline
                        dheerendraD Offline
                        dheerendra
                        Qt Champions 2022
                        wrote on last edited by
                        #10

                        what do you mean by not added ? Is something not working for you ? On what basis are you telling that it is not added ? Did you open the moc_UploadExistingAPi file & verify ? Can you see the time stamp of this file ? If you use those slot, is slot getting called ? I saw that you are creating stack object of retryTimer. Hope the object is still is in scope.

                        You said last one is added. First three are added. By chance did some body kept the moc files somewhere else ? If last one is added, first three also should be added.

                        Dheerendra
                        @Community Service
                        Certified Qt Specialist
                        http://www.pthinks.com

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          mahd96
                          wrote on last edited by
                          #11

                          @mrjj @SGaist
                          I solved the issue by reinstalling msvc2015

                          I recently installed Visual Studio 2017 and i had visual studio2015 in my pc. i think the were some kind of incompibality there that cause this issue.
                          i try to reset my windows and make a clean install of Visual studio(i need msvc compiler and windows kits) and it worked

                          1 Reply Last reply
                          1

                          • Login

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