qtzcute
16th August 2009, 17:44
hi geeks and helpers,
I am trying to limit a text inside the borders of shapes, i draw in QGraphicsView. Shapes are basically items (QGraphicsItem). I set text on them by following LOCs each time i draw one.
QGraphicsTextItem *text = new QGraphicsTextItem(this);
text->setTextInteractionFlags(Qt::TextEditorInteraction) ;
text->setPos(5,-245);
text->setPlainText(name);
where 'name' is just a QString that stores name of the shape being drawn.
Now, if the length of the text gets greater than the width of shape, it flows out of the borders of shape as evident in the attached pics.
Does Qt provide some quick way out of it?
Thankyou.
I am trying to limit a text inside the borders of shapes, i draw in QGraphicsView. Shapes are basically items (QGraphicsItem). I set text on them by following LOCs each time i draw one.
QGraphicsTextItem *text = new QGraphicsTextItem(this);
text->setTextInteractionFlags(Qt::TextEditorInteraction) ;
text->setPos(5,-245);
text->setPlainText(name);
where 'name' is just a QString that stores name of the shape being drawn.
Now, if the length of the text gets greater than the width of shape, it flows out of the borders of shape as evident in the attached pics.
Does Qt provide some quick way out of it?
Thankyou.