Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting QGraphicsTextItem length?

Is there anyway to calculate the text's length when TextWidth = -1?.

I have a rectangle that has a QGraphicsTextItem in it, and I want to change the rectangle's width when characters exceed the rectangle.

like image 821
Baris Atamer Avatar asked Jun 04 '26 22:06

Baris Atamer


1 Answers

I found this post by stopping on the same problem.

i'm using text->boundingRect().width()to get the width.

Perhaps it helps anybody

like image 109
Alexander Avatar answered Jun 07 '26 23:06

Alexander