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 signal with slot in slot function
QtWS25 Last Chance

connect signal with slot in slot function

Scheduled Pinned Locked Moved Solved General and Desktop
connectionqmetaobjectconcurrent
3 Posts 2 Posters 381 Views
  • 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
    MintogoDeveloper
    wrote on 3 May 2022, 00:30 last edited by
    #1

    Hi,

    I create a concurrent job and connect futuer's finished to onFinished slot.

    like this

    QFutureWatcher<QJsonObject>* future_watcherr = new QFutureWatcher<QJsonObject>();
    
    		QObject::connect(future_watcherr , SIGNAL(finished()), this, SLOT(onFinished()));
    
    this->_watcherList.push_back(future_watcher);
    

    after that, in onFinsihed function I connect another class signal to lamdat function.

    void MyClass::onFinished()
    {
        for (int i = _watcherList.size() - 1; i >= 0; i--)
        {
            if (_watcherList[i]->isFinished() == true)
            {
                QMetaObject::Connection* connection = new QMetaObject::Connection;
                connection = QObject::connect(&Woker::getInstance(), &Woker::anotherJobFinished,
                		[this, job_id, pid, scan_id](unsigned long long id, bool result, QString doc_str)
                 	        {
                                if (result == true)
                 		    {
                			_renderer->SaveSceneEvent();
                		    }
    
                		    emit endSaveRAYFaceModelsJob(result);
                
                		    Worker::getInstance().DisconnectConnection(job_id);
                	        }
                	);
    
                  Woker::getInstance().anotherJob(job_id)
             }
        }
    }
    

    It said to me AreArgumentCompatible error,

    Is it impossible syntax?

    J 1 Reply Last reply 3 May 2022, 05:16
    0
    • M MintogoDeveloper
      3 May 2022, 00:30

      Hi,

      I create a concurrent job and connect futuer's finished to onFinished slot.

      like this

      QFutureWatcher<QJsonObject>* future_watcherr = new QFutureWatcher<QJsonObject>();
      
      		QObject::connect(future_watcherr , SIGNAL(finished()), this, SLOT(onFinished()));
      
      this->_watcherList.push_back(future_watcher);
      

      after that, in onFinsihed function I connect another class signal to lamdat function.

      void MyClass::onFinished()
      {
          for (int i = _watcherList.size() - 1; i >= 0; i--)
          {
              if (_watcherList[i]->isFinished() == true)
              {
                  QMetaObject::Connection* connection = new QMetaObject::Connection;
                  connection = QObject::connect(&Woker::getInstance(), &Woker::anotherJobFinished,
                  		[this, job_id, pid, scan_id](unsigned long long id, bool result, QString doc_str)
                   	        {
                                  if (result == true)
                   		    {
                  			_renderer->SaveSceneEvent();
                  		    }
      
                  		    emit endSaveRAYFaceModelsJob(result);
                  
                  		    Worker::getInstance().DisconnectConnection(job_id);
                  	        }
                  	);
      
                    Woker::getInstance().anotherJob(job_id)
               }
          }
      }
      

      It said to me AreArgumentCompatible error,

      Is it impossible syntax?

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 3 May 2022, 05:16 last edited by
      #2

      @MintogoDeveloper said in connect signal with slot in slot function:

      It said to me AreArgumentCompatible error

      Please post the whole error!
      "Woker::getInstance()" - what is Woker and what are anotherJobFinished parameters?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • M Offline
        M Offline
        MintogoDeveloper
        wrote on 4 May 2022, 00:44 last edited by
        #3

        @jsulm Sorry, it's my fault.
        I write wrong parameters at lamda function :(;;;

        1 Reply Last reply
        1

        1/3

        3 May 2022, 00:30

        • Login

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