Qt-jambi-interest Archive, February 2008
QGraphicsPixmapItem with Text Label ?
Message 1 in thread
Is there something like the QGraphicsPixmapItem that
can be added to a scene and display an image, but also
with a text label centered underneath ?
Thanks,
Danny
____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
Message 2 in thread
Danny Sporea wrote:
> Is there something like the QGraphicsPixmapItem that
> can be added to a scene and display an image, but also
> with a text label centered underneath ?
Hi Danny,
There is no "direct" API for this, but it is fairly easy to achieve
using one of the following methods:
- Create a QGraphicsSimpleTextItem with the text and a
QGraphicsPixmapItem with the image, both with the same QGraphicsItem
parent and position under parent relative to each other. Since they
share the same parent they will transform in unison etc. You may need to
override the parents boundingbox to get proper behaviour though...
- Create the <html> text for what you want to achieve and set it as
the content of a QGraphicsTextItem
- Subclass QGraphicsItem and do it yourself ;-)
No 2 is probably the most straightforward.
best regards,