[solved]Setting two images in a single QGraphicsView

  • Hi, I am trying to grab images from two QGraphicsViews in my widget and setting it in another QGraphicsView on the same widget created using QCreator. The problem which i am facing is :

    1)Making both of the images visible in single widget, i guess i can try changing the opacity of the images or apply difference transform to it. I would like to have your suggestion which is the better method and some suggestion how to implement it.

    1. Adding the scenes which i grab from the other QGraphicsView into the third view. From some posts i came to know that, it can be done using adding the scene() into QGraphicsPixmapItem and setting the flags for it as movable and draggable.But i couldn't find how to add the scenes which are currently in the views into QGraphicsPixmapItems The code which i tried is

    void Widget::on_pushButton_7_clicked()
    QGraphicsScene *scn = ui->graphicsView->scene();
    item->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
    scn = ui->graphicsView_2->scene();
    item1->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);

    I know it's wrong, but i just wanted to post it to give an idea what i wanted to implement. I would be honoured to have your suggestions to implement it.

    Venkatesh Padmanabhan

  • Hi,

    Still no one could reply to this query nor any information regarding this in qt blog :(

  • I would use QPainter to draw 2 images at given coordinates inside 3. QGraphicsView (in its paint event ufcorse) . That way you can move, scale rotate, blend...

  • Hi,

    I have used a single @scene@ and two @QListWidgetItem@ to add the images in the items and add it in same @scene@ This solved my problem...

Log in to reply

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