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. How can i get a QPixmap from a QGraphicsPolygonItem
Qt 6.11 is out! See what's new in the release blog

How can i get a QPixmap from a QGraphicsPolygonItem

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

    how can i get a QPixmap from a QGraphicsPolygonItem?
    i want to add a QGraphicsPolygonItem to QDrag::setPixmap(), is there any way to do this?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You can use "QGraphicsScene::render":http://qt-project.org/doc/qt-5/qgraphicsscene.html#render to render the part where you polygon item can be found on a QPixmap.

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • O Offline
        O Offline
        opengpu
        wrote on last edited by
        #3

        thank you
        but i mean that i have a custom class inherited from QGraphicsPolygonItem.
        and i want to set it as the param of QDrag::setPixmap().
        so i want to transform the QGraphicsPolygonItem to QPixmap.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          That I understood, however AFAIK, there's no direct way from QGraphicsPolygonItem to QPixmap.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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