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. [solved]Setting two images in a single QGraphicsView
QtWS25 Last Chance

[solved]Setting two images in a single QGraphicsView

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.5k 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.
  • V Offline
    V Offline
    venkatesh
    wrote on last edited by
    #1

    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();
    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

    1 Reply Last reply
    0
    • V Offline
      V Offline
      venkatesh
      wrote on last edited by
      #2

      Hi,

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

      1 Reply Last reply
      0
      • P Offline
        P Offline
        puksec
        wrote on last edited by
        #3

        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...

        1 Reply Last reply
        0
        • V Offline
          V Offline
          venkatesh
          wrote on last edited by
          #4

          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...

          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