View Full Version : QValidator for QGraphicsTextItem
arjunasd
8th August 2007, 05:24
Hi all
I have a QGraphicsTextItem that is editable. I want to assign a validator to it when I edit the contents. I know how to do it for a QLineEdit.
can anyone guide me how to use it for QGraphicsTextItem?
Thanks
Arjun
marcel
8th August 2007, 06:31
There is no such default functionality in QGraphicsTexItem. But you can add it to it.
You'll have to work directly with the QTextDocument provided by QGraphicsTextItem::textDocument().
You can connect to QTextDocument::contentsChanged signal and do all the validation in there, either using a standard or costom QValidator.
Regards
Gopala Krishna
8th August 2007, 13:53
Even i do need such a functionality in my app but busy with something else at the moment. If you are able to achieve this, can you share your idea(or if possible code) please ?
Gopala Krishna
8th August 2007, 13:58
BTW currently i am validating text in the focusOutEvent() of the text item. I am not using any of QValidators for now.
Sorry , forgot to post this in my previous post :(
arjunasd
8th August 2007, 16:34
Sure. Once I have something I will post it.
Arjun
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.