PDA

View Full Version : QTextEdit partial read-only



pckoster
27th November 2009, 09:40
Hi all,

For a reporting tool I am writing, I need to generate a report based on a database record. I want to use the QTextDocument with a predefined template. For some last minute layout adjustments - templates are not always perfect in every situation - I want the user to be able to edit only the text / layout which is NOT from the database. So a QTextEdit editor which has the database texts made read-only.

Anyone knows if this is possible?

fullmetalcoder
13th December 2009, 12:12
I don't think QTextDocument (http://doc.trolltech.com/latest/qtextdocument.html)/QTextEdit (http://doc.trolltech.com/latest/qtextedit.html) offer such fine-grained control over editability but it should be possible to implement it through a couple of event handlers reimplementations or smart use of signal/slots.

the naive way would be to catch QTextEdit::cursorPositionChanged() (http://doc.trolltech.com/latest/qtextedit.html#cursorPositionChanged) and adjust the readOnly flag depending on the cursor position.