Results 1 to 2 of 2

Thread: QTextEdit partial read-only

  1. #1
    Join Date
    Mar 2009
    Location
    Leiden, The Netherlands
    Posts
    10
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default QTextEdit partial read-only

    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?

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit partial read-only

    I don't think QTextDocument/QTextEdit 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() and adjust the readOnly flag depending on the cursor position.
    Current Qt projects : QCodeEdit, RotiDeCode

Similar Threads

  1. Vertical centering of a QTextEdit
    By miwarre in forum Newbie
    Replies: 4
    Last Post: 5th October 2015, 05:01
  2. Drawing on QTextEdit
    By jgrauman in forum Qt Programming
    Replies: 3
    Last Post: 7th February 2009, 09:40
  3. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 12:05
  4. QIODevice read()
    By ShaChris23 in forum Newbie
    Replies: 1
    Last Post: 3rd May 2007, 00:29
  5. QTextEdit API questions (plain text)
    By Gaspar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 06:03

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.