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. Retrive QPainter pointer

Retrive QPainter pointer

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.8k 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.
  • Q Offline
    Q Offline
    qwertyuiopearendil
    wrote on last edited by
    #1

    Hi All,
    I'd like to know if should be possible to retrive with some function the pointer to painter into QGraphicsObject, something like:

    @
    MyGraphicsObject *mgo=new MyGraphicsObject;
    QPainter *myPainter=mgo->getPainter();
    @

    Thanks

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dialingo
      wrote on last edited by
      #2

      Could you describe the context of your question? What are you trying to achieve if you had QPainter?

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        If you want to paint somewhere, you go this way:

        QPainter paint(&myWidget);

        where &myWidget is a pointer to a paint device.

        The objects do not have own painters, but you xcan create paionters on the objects. Is that what you were locking fore?

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          qwertyuiopearendil
          wrote on last edited by
          #4

          When i create a class inherit from a QGraphicsObject i must implement some function like paint(...). In this function there's an object, QPainter, that permit to draw into the graphics context of my graphicsobject.
          For some reason i'd like to create an object that retrive this obj and could be draw directly on the graphicsobject.
          I suppose that your suggest could be the way that i'm finding.
          Let you know soon with the result.
          Thanks.

          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