[SOLVED] QGraphicsItem always visible in QGpraphicScene

  • Hi everyone,

    I spent two day trying to figure out how to solve my problem but I'm not able to find a solution. I'm sure it is a matter of setting the right property but I do not which I have to modify. I created a simple code to show an image in a QGraphicScene and every time an event happens the image is modified and showed in the scene. At the same time I need to create a Line item and show it in the center of the scene. I did it in this way:

    void inspection::on_horizontalSlider_actionTriggered(int action)
    int value2 = ui->horizontalSlider->value();
     //here I create the transfer_image
    QGraphicsPixmapItem* item_pop = new      
    if (pass ==false)
    // if it is the first time I create the line
          item = new MyItem();
     pass = true;

    My problem is that the first time I enter the function I can see the object but then every time I update the scene I cannot see the line anymore. How can I keep it always on the top of the scene?

    thank you

  • @tmoranduzzo

    I added


    to update the view and that solved my problem

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.