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. Display a pricture from the MainWidow's slot function
QtWS25 Last Chance

Display a pricture from the MainWidow's slot function

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 741 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.
  • T Offline
    T Offline
    thomas11live.com.sg
    wrote on last edited by
    #1

    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
    0

    • Login

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