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.
text->setTextInteractionFlags(Qt::TextEditorInteraction);
text->setPos(5,-245);
text->setPlainText(name);
QGraphicsTextItem *text = new QGraphicsTextItem(this);
text->setTextInteractionFlags(Qt::TextEditorInteraction);
text->setPos(5,-245);
text->setPlainText(name);
To copy to clipboard, switch view to plain text mode
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.
Bookmarks