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. Insert and remove items from QGraphicsScene/QGraphicsView

Insert and remove items from QGraphicsScene/QGraphicsView

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 4.9k Views 1 Watching
  • 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.
  • L Offline
    L Offline
    Lunarix
    wrote on last edited by Lunarix
    #1

    Hello,
    I have a QGraphicsView and I draw a scene with QGraphicsScene onto it.
    Now I'd like to have some object which I can place on the QGraphicsView and remove them again (for example: PushButton click)
    So first click - something, let's say a image, is drawn on the QGraphicsScene and secound click it is removed again. I have to draw it in different x,y coordiantes for each click.

    How do I implement this?
    Thanks in advance

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by Eddy
      #2

      Hi,

      You may have a look at the diagramscene example
      Or did you already?

      Eddy

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      1
      • K Offline
        K Offline
        KonradMD
        wrote on last edited by
        #3

        Did you find a solution?
        You can handle it with Items like

        First Button click, you can use a runtime variable or use a button with enable and disable

        QGraphicLineItem = QGraphicsScene->addLine(.....);

        second click would be

        QGraphicsScene->removeItem(QGraphicLineItem);

        You can save it in a vector if you have several things to draw and remove.

        1 Reply Last reply
        1

        • Login

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