PDA

View Full Version : a question about visualizing cursor in read-only QTextEdit



kennyxing
16th September 2006, 06:53
I want to set a QTextEdit as read only, but I still want to show the cursor, how do I do that?

Actually, I'm hoping that the QTextEdit receives key event so that only arbitrary set of characters are received and displayed in QTextEdit.That's why I set it as read only and still want the cursor visible. If QTextEdit cannot do that, any other widget can do it?

e8johan
16th September 2006, 09:10
If you just want to filter key events, either use a sub-classes QTestEdit or an event filter on a QTextEdit. That way you can keep it editable.

Another way to validate user input is to use a QValidator.

kennyxing
16th September 2006, 10:18
Thanks.

But it still seems that a visual cursor in a read only editor is the way to fit my requirement. I know Java can do it.

Chicken Blood Machine
17th September 2006, 19:52
Thanks.

But it still seems that a visual cursor in a read only editor is the way to fit my requirement. I know Java can do it.

And Qt can do it too. You've just been told how to solve this problem.