PDA

View Full Version : How to be notified when a child changes?



mooreaa
3rd July 2008, 10:48
If I have a parent object who has a child that is a QGraphicsTextItem, is there a way for a notification to be sent to the parent when the QGraphicsTextItem is changed?

I'm looking at itemChange but don't see a way to do this.

Basically I'm trying to keep the text centered to my object as I type. Right now I don't even get a notification that the text is changed so it won't stay centered.

Also I'm looking for a way to force single line. Is this possible? If not what is the best way to keep it centered. This text object is the "label" for my node, and thats why I want it centered on my parent object which is the node.

I tried this originally without the QGraphicsTextItem, but I want the user to be able to edit it and I didn't want to reimplement everything that QGraphicsTextItem already implemented.

aamer4yu
3rd July 2008, 13:04
Explore these -
QGraphicsTextItem::document

QTextDocument::contentsChange

QTextDocument::contentsChanged


Hope they help you out :)