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. is it necessary to use connection for frequent gui updation ??
Qt 6.11 is out! See what's new in the release blog

is it necessary to use connection for frequent gui updation ??

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtableviewsignal & slot
2 Posts 2 Posters 937 Views 1 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.
  • V Offline
    V Offline
    vasu_gupta
    wrote on last edited by
    #1

    I am working on a code which is used for automated dimension check on the basis of camera image...
    for each new image the gui qlable and table(containing dimension details and pass or fail result) gets updated at the rate of 400 images per minute now , i am doing these updates using setvalue and all functions ....recently i came across a forum:
    https://forum.qt.io/topic/24358/solved-qwidget-repaint-recursive-repaint-detected

    according to which not using connection is an isuue...so can some one tell me if using setvalue fuction can become a problem or not if so then please tell me how to update table content and variable values with signal and slot

    void StackedWidget_new::run_camimage()
    {
        ////////CODE FOR TRIGGERING TEST SAMPLES FOR ALL 4 CAMERAS
        int k= fr_run.size();
        FrameRec frame;
       // qDebug()<<"REACHED HERE RUN_CAM";
    
        for(int i =0;i<k;i++)
        {
    
                frame=fr_run.back();
                fr_run.pop_back();
                cv::Mat m_ConvertImage=cv::Mat(frame.Height,frame.Width,CV_8UC1);
                std::copy( frame.buff, frame.buff+frame.Height*frame.Width, m_ConvertImage.data );
               if(frame.CameraIndex==0)
               {
                   Cam1_run=m_ConvertImage;
                   cam1_run = Mat2QImage(m_ConvertImage);
                   ui->IMAGE_CAM_5->setPixmap(QPixmap::fromImage(cam1_run));
                   ui->IMAGE_CAM_9->setPixmap(QPixmap::fromImage(cam1_run));
    
               }
               else if(frame.CameraIndex==1)
               {
                    Cam2_run=m_ConvertImage;
                   cam2_run = Mat2QImage(m_ConvertImage);
                   ui->IMAGE_CAM_6->setPixmap(QPixmap::fromImage(cam2_run));
                   ui->IMAGE_CAM_10->setPixmap(QPixmap::fromImage(cam2_run));
               }
               else if(frame.CameraIndex==2)
               {
                    Cam3_run=m_ConvertImage;
                   cam3_run = Mat2QImage(m_ConvertImage);
                   ui->IMAGE_CAM_7->setPixmap(QPixmap::fromImage(cam3_run));
                   ui->IMAGE_CAM_11->setPixmap(QPixmap::fromImage(cam3_run));
               }
               else if(frame.CameraIndex==3)
               {
                   Cam4_run=m_ConvertImage;
                   cam4_run = Mat2QImage(m_ConvertImage);
                   ui->IMAGE_CAM_8->setPixmap(QPixmap::fromImage(cam4_run));
                   ui->IMAGE_CAM_12->setPixmap(QPixmap::fromImage(cam4_run));
               }
               if(fr.size()==0)
               {
                   CalibClick[2]=0;
               }
        }
        for(int i=0;i<ftr.size();i++)
        {
            switch (ftr[i]->cam_id)
            {
            case 1:
    
                ui->tableWidget_2->item(ftr[i]->index,4)->setText(QString::number(ftr[i]->inpix));
                ui->tableWidget_2->item(ftr[i]->index,5)->setText(QString::number(ftr[i]->inmm));
    
               if(ftr[i]->decision==1)
                        ui->tableWidget_2->item(ftr[i]->index,6)->setText("PASS");
                else
                        ui->tableWidget_2->item(ftr[i]->index,6)->setText("FAIL");
    
                break;
    
            case 2:
                ui->tableWidget_6->item(ftr[i]->index,4)->setText(QString::number(ftr[i]->inpix));
                ui->tableWidget_6->item(ftr[i]->index,5)->setText(QString::number(ftr[i]->inmm));
                        if(ftr[i]->decision==1)
                                ui->tableWidget_6->item(ftr[i]->index,6)->setText("PASS");
                        else
                                ui->tableWidget_6->item(ftr[i]->index,6)->setText("FAIL");
                break;
            case 3:
                ui->tableWidget_7->item(ftr[i]->index,4)->setText(QString::number(ftr[i]->inpix));
                ui->tableWidget_7->item(ftr[i]->index,5)->setText(QString::number(ftr[i]->inmm));
                        if(ftr[i]->decision==1)
                                ui->tableWidget_7->item(ftr[i]->index,6)->setText("PASS");
                        else
                                ui->tableWidget_7->item(ftr[i]->index,6)->setText("FAIL");
                break;
            case 4:
                ui->tableWidget_8->item(ftr[i]->index,4)->setText(QString::number(ftr[i]->inpix));
                ui->tableWidget_8->item(ftr[i]->index,5)->setText(QString::number(ftr[i]->inmm));
                        if(ftr[i]->decision==1)
                                ui->tableWidget_8->item(ftr[i]->index,6)->setText("PASS");
                        else
                                ui->tableWidget_8->item(ftr[i]->index,6)->setText("FAIL");
                break;
    
            }
        }
    
    
    }
    

    this is how i am updating table and qlabel right now

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

      Hi
      it will only be a problem if you make too long lasting loop.
      Then it will stop redrawing.

      1 Reply Last reply
      0

      • Login

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