PDA

View Full Version : QGraphicsTextItem size



Angelo Moriconi
26th January 2007, 09:23
Hello everybody!

I try to use the QGraphics framework to create a custom QGraphicsItem that contain some
text and images. The custom widget is created and contains some QGraphicsTextItem as a child to manage the textual areas.

I have a problem to set the size of the textual editable areas.
I currently use a QGraphicsTextItem. I can set the width of the item (respect to the parent Item) using the setTextWidth() method.
I try to create a QTextDocument with a fixed size (to be used for the QGraphicsTextItem) using setPageSize() to specify the document size but with no good result.

What is the best way to limit the size of a QGraphicsTextItem (if exist one) ?

I have also a problem of refresh. I put, in the paint method of the custom item, a rounded rect . When I edited the text in the QGraphicsItem the background seems to doesn't repaint, near the edited text a white rect is painted and only when I refresh the entire window the QGraphicsItem is repainted well. Any suggestions ?

Thanks in advance,

Angelo

Angelo Moriconi
26th January 2007, 09:34
Just a quick notification !

The refresh issue has been resolved (I paint something outside the bounding rect :) ), this
cause a lot of problems also when I moved the Item in the scene.