[Qt-jambi-interest] Making sections of text in a QTextEdit uneditable

Derek Fountain dflists at gmail.com
Wed Nov 12 10:29:07 CET 2008


> As far as crazy ideas go, this one is probably shooting for the top 10: I want 
> to show the user a text edit control with a fragment of source code. Parts of 
> that fragment are shown only as a convenience to provide context information 
> and should not be altered by the user. So this means that there are about 1 or 
> 2 lines at the start and at the end of the fragment which should not be 
> editable by the user (while the middle section is fully editable).

I've not even played with QTextEdit as yet, but I notice it has a 
cursorPositionChanged() signal and a setReadOnly() method. So how about 
connecting that signal to a routine that switches the widget to read 
only when the cursor is moved into certain areas? Or maybe less 
confusingly for the user, don't actually allow the cursor into those 
areas in the first place?



More information about the Qt-jambi-interest mailing list