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. QThread struct reponse example ?
QtWS25 Last Chance

QThread struct reponse example ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qthreadstruct
2 Posts 2 Posters 827 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.
  • R Offline
    R Offline
    RahibeMeryem
    wrote on 18 Feb 2018, 17:41 last edited by kshegunov
    #1

    Hi ,

    I have worker Thread and defined a strcut:

    struct response{
            QImage _qimage;
            QString _t1;
            qint16 _int1;
        };
        response cevap;
    
        void _frameChangedStruct (const response &cevap);
    

    and in main:

    connect(worker, SIGNAL(_frameChangedStruct(response)), this , SLOT(displayFrame(response)));
    
    void MainWindow::displayFrame(QImage qimg){
    
    
           ui->FrameWindow->setPixmap(QPixmap::fromImage(cevap_._qimage));
    
    }
    

    It is not updating the widget. What is the correct way to pass a struct to the main thread ?

    thx

    [Fixed code tags ~kshegunov]

    K 1 Reply Last reply 18 Feb 2018, 19:05
    0
    • R RahibeMeryem
      18 Feb 2018, 17:41

      Hi ,

      I have worker Thread and defined a strcut:

      struct response{
              QImage _qimage;
              QString _t1;
              qint16 _int1;
          };
          response cevap;
      
          void _frameChangedStruct (const response &cevap);
      

      and in main:

      connect(worker, SIGNAL(_frameChangedStruct(response)), this , SLOT(displayFrame(response)));
      
      void MainWindow::displayFrame(QImage qimg){
      
      
             ui->FrameWindow->setPixmap(QPixmap::fromImage(cevap_._qimage));
      
      }
      

      It is not updating the widget. What is the correct way to pass a struct to the main thread ?

      thx

      [Fixed code tags ~kshegunov]

      K Offline
      K Offline
      kshegunov
      Moderators
      wrote on 18 Feb 2018, 19:05 last edited by
      #2

      response is quite different from QImage, so you should start by matching your function prototypes. To that end you should use the Qt5 connect syntax, which is going to throw you a compile-time error for that code, as it justifiably should. I don't understand the rationale between that global variable - response cevap; though, you should explain what prompted you to use it like this.

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      4

      1/2

      18 Feb 2018, 17:41

      • 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