PDA

View Full Version : QGraphicsTextItem editing event



Seishin
16th November 2012, 21:56
Hi,

I try to draw the bounding rectangle of a QGraphicsTextItem by adding the rectangle as a child of QGraphicsTextItem.

I have enabled setTextInteractionFlags(Qt::TextEditorInteraction) , and the rectangle is reseted in keypress(), keyRelease() and itemChange() events of QGraphicsTextItem.
The problem is after key pressing and before key releasing, the rectangle is not up to date, like the image below.
You can see the bulit-in selection rectanlgle does changed with new typed letter, but my bounding rectangle does not.
Can anybody tell me how to make my bounding rectangle up to date? I cannot find a suitable event. Thanks.
8422

Update:
Solved. Use Paint event.