Results 1 to 3 of 3

Thread: "Protecting" pieces of text

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

    Unhappy "Protecting" pieces of text

    I'm using QTextDocument and related classes quite a lot and I came accross a problem : I want some text to be temporarily hidden. My current solution is to put it into a custom QTextBlockUserData which is attached to the block. The next problem is to ensure that this block can't be deleted and that the remaining text (which indicates that some text has been hidden) won't be modified. Is there any way to create a read-only" structure (block, frame, whatever...) within a QTextDocument ???

    Another trouble is that the use of a block data sometimes break the Undo/Redo system because I di not find any way to catch this actions and adapt my custom block datas accordingly...
    Current Qt projects : QCodeEdit, RotiDeCode

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: "Protecting" pieces of text

    Do you need that to implement code "folding" within the editor? Maybe it's better to hide it in the editor and not in the document? I don't know if it's possible, but it'd certainly be better to do it this way.

  3. #3
    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: "Protecting" pieces of text

    Quote Originally Posted by wysota View Post
    Do you need that to implement code "folding" within the editor? Maybe it's better to hide it in the editor and not in the document? I don't know if it's possible, but it'd certainly be better to do it this way.
    It would probably be better... if it were possible... You see, Qt leave very little room for "real" subclassing. And the Trolls are wise but they seem to have forgotten some features... i've searched for such a solution but I did not find any... The only way would be to reimplement text rendering but Qt 4 does not allow that... Unless you redo everything from scratch...

    As for the undo/redo I've just checked the sources and QTextDocument does not make use of the Undo framework so I also get screwed here...
    Current Qt projects : QCodeEdit, RotiDeCode

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Problem pasting text into a QTextEdit
    By Spockmeat in forum Qt Programming
    Replies: 8
    Last Post: 14th March 2009, 14:36
  3. Editable text in QGraphicsView
    By wysota in forum Qt Programming
    Replies: 8
    Last Post: 24th February 2007, 15:30
  4. visible text of textedit
    By regix in forum Qt Programming
    Replies: 3
    Last Post: 26th June 2006, 09:02

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.