PDA

View Full Version : How to Make some part of qLineEdit editable?



jayesh.srs
8th November 2012, 06:22
I am using QT 4.8.2 and i am trying to make some part of qLineEdit as editable.
For eg:
I want to make only the last octet of an IP address as editable, and keep all other three octet as readonly or not editable.

Is there any solution achieve this feature in my application.
Or is there any QT widget other than qLineEdit to implement the same in my application
Please help me get one as soon as possible

Thanks

pkj
8th November 2012, 07:55
No, such a feature is not available out of the box. You can have multiple qlineedit's as a cheap solution. Or you need to subclass qlineedit and write the code yourself.
Similar code is written already for QDateTimeEdit. You can go through its source code to get the ideas.

Santosh Reddy
8th November 2012, 07:58
There no such widget is available. You either have to implement a custom QLineEdit, or connect to QLineEdit signal for textChanged(), and then validate it and update the text again. (Be careful about the recussuive textChanged signal being emited)