Results 1 to 2 of 2

Thread: QPainter in QGraphicsScene

  1. #1
    Join Date
    Jan 2011
    Posts
    24
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QPainter in QGraphicsScene

    Can i use QGraphicsScene or QGraphicsItem as the paint device to the QPainter , instead of using it in paint(). The document shows that only widgets like image,picture,etc can be used to paint using painter.
    I have a necessity of drawing text for every 1sec for an item. I can draw text in paint(), but it is causing burden on application.

  2. #2
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPainter in QGraphicsScene

    You misunderstand the purpose of QGraphicsScene and QGraphicsItem. They aren't paint devices. Better yet, they work on paint devices (like QWidgets). QGraphicsScene and QGraphicsItem describe the scene and item. They paint themselves onto a paint device.

    If the text doesn't change, use QPainter::drawStaticText().
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

Similar Threads

  1. QGraphicsScene vs QPainter techniques
    By zotu in forum Newbie
    Replies: 3
    Last Post: 23rd October 2010, 09:55
  2. QPainter(&QPrinter) & QPainter(&QImage) communication
    By gufeatza in forum Qt Programming
    Replies: 2
    Last Post: 2nd February 2010, 07:25
  3. QPainter error saving an image from a QGraphicsScene
    By cydside in forum Qt Programming
    Replies: 3
    Last Post: 29th January 2010, 04:53
  4. Replies: 5
    Last Post: 7th September 2009, 20:57
  5. Replies: 3
    Last Post: 30th April 2006, 19:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.