Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. [Resoved]How de copy and paste drawn objets
QtWS25 Last Chance

[Resoved]How de copy and paste drawn objets

Scheduled Pinned Locked Moved Game Development
10 Posts 3 Posters 5.9k 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.
  • S Offline
    S Offline
    SamFaye
    wrote on last edited by
    #1

    I want to copy and past, cut and past objet which i drawn. These object are circle, square, line, image...

    How can i do this with the QClipboard classe?

    Help please

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

      Are you using graphicsview, painter ....

      Can you give us more detail please?

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SamFaye
        wrote on last edited by
        #3

        I'm using QGraphicsScene in which there are a graphicsview, my items are of type QGraphicsEllipseItem, QGraphicsPixmapItem, QGraphicsItemGroup, QGraphicsLineItem, QGraphicsProxyWidget, QGraphicsPolygonItem, QGraphicsRectItem, QGraphicsSimpleTextItem.

        And I use the addItem() methode of the QGraphicsScene.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SamFaye
          wrote on last edited by
          #4

          Anyone can help me

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

            In the "GraphicsView docs":http://doc.qt.nokia.com/4.7/graphicsview.html#drag-and-drop you can find some information about drag and drop.

            Have you looked in the examples?

            Qt Certified Specialist
            www.edalsolutions.be

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SamFaye
              wrote on last edited by
              #6

              I don't want to do a drag and drop. I want to duplicate the drawn objects which are selected in the GraphicsScene by using the QClipboard classe

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SamFaye
                wrote on last edited by
                #7

                I serialize my objects using QDomDocument what I want now is how to pass this type to QClipboard ??

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SamFaye
                  wrote on last edited by
                  #8

                  I've resoved my problem. What I do is: when items are selected I serialize them and create a xml text. And I covert the QDomDecoment whitch contain the xml text to string and put the string in the clipboard.

                  In the method whitch process the paste I get the text in the clipboar and deserialize it.

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

                    Well done! Thanks for sharing your solution ;)

                    could you change the title to [Solved]?

                    [Resoved] will not be recognized when topics will get more functionality to show solved topics in the future. Thanks.

                    Qt Certified Specialist
                    www.edalsolutions.be

                    1 Reply Last reply
                    0
                    • V Offline
                      V Offline
                      vinzzz
                      wrote on last edited by
                      #10

                      hi i am a new to Qt, i couldn't find how u will serialize selected items, if you copy an selected item like which i done below i just get a shallow copy of an item, how do we actually get this selected item and serialize it. plz show it with a small example

                      QList<QGraphicsItem *> copiedItem = this->selectedItems();

                      All i want to finally do is, i wanted to copy and paste QGraphicItem on my QGraphicScene .

                      thanks in advance

                      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