Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Display a pricture from the MainWidow's slot function

    General and Desktop
    1
    1
    669
    Loading More Posts
    • 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.
    • T
      thomas11live.com.sg last edited by

      Dear All,
      I have a thread for the image capturing and whenever new image is captured, MainWindow's SLOT method (newImageReceivedInformed()) is called. SIGNAL and SLOT connection works well, i have tested already.
      Now I am testing with offline image and when plot() is called from newImageReceivedInformed(), test.png is not displayed. Only displayed when plot() is called from MainWindow's any other methods. What could be the problem?
      @
      void MainWindow::newImageReceivedInformed(imageData receiveImage)
      {
      plot();
      }

      void MainWindow::plot()
      {
      QImage *qImg;
      QPixmap pixma;

      qImg = new QImage();
      if(!(qImg->load("/home/user/Desktop/test.png")))
      {
              qWarning("ERROR");
      }
      
      pixma = QPixmap::fromImage(*qImg);
      pixmaItem->setPixmap(pixma);
      
      
      
      scene->addItem(pixmaItem);
      view->setScene(scene);
      scene->setSceneRect(0,0,300,200);
      view->setRenderHints(QPainter::Antialiasing);
      
      
      view->show();
      delete qImg;
      

      }@

      [Edit: Added @ tags for formatting -- mlong]

      1 Reply Last reply Reply Quote 0
      • First post
        Last post