[solved]Setting two images in a single QGraphicsView
-
wrote on 1 Sept 2013, 10:38 last edited by
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.
- 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();
scn->addItem(item);
item->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
scn = ui->graphicsView_2->scene();
scn->addItem(item1);
item1->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
ui->graphicsView_3->setScene(scn);
ui->graphicsView_3->show();
ui->graphicsView_3->setScene(scn);
ui->graphicsView_3->show();
update();
}
@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.
Regards,
Venkatesh Padmanabhan -
wrote on 6 Sept 2013, 18:52 last edited by
Hi,
Still no one could reply to this query nor any information regarding this in qt blog :(
-
wrote on 12 Sept 2013, 14:35 last edited by
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...
-
wrote on 30 Sept 2013, 13:01 last edited by
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...