[Qt-interest] Make a few lines of a QTextEdit uneditable?

Martin Hofius Martin at hofius-online.com
Tue May 26 13:54:57 CEST 2009


Am Dienstag, 26. Mai 2009 schrieb Ellen Kestrel:
> So the QTextEdit is in one of these dialogs, and you want the user not to
> be able to edit certain parts of the code?  I'm still not really
> understanding this - can you give an example?

if I understand it right you should think of a code editor in old delphi or 
sybase power++ or netbeans: the form editor generates some source code and 
the user can only change code between the generated parts.

As a solution a would propose to inherit the editor widget and overwrite the 
keypress handler - if the cursor is located in the readonly area, any key 
except cursor movements should be discarded... of cource this concept can be 
extended by setting grey color these area, change cursor icon and so on.

Greetings
Martin 



More information about the Qt-interest-old mailing list