Problems with Open-Source Downloads read and

Retrive QPainter pointer

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


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

  • 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?

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

Log in to reply