Results 1 to 4 of 4

Thread: Inline edit of multiline text widget?

  1. #1
    Join Date
    Jun 2006
    Posts
    81
    Thanks
    6
    Thanked 5 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Question Inline edit of multiline text widget?

    Hi all,

    I require a multiline text widget that allows to edit parts of it while keeping the rest of the text ineditable; a kind of enhanced QTextEdit. Think of Qt Creator's CppEditor in refactor/rename mode, without synchronizing multiple occurrences, but simultaneous markup of editable text fragments.

    Maybe this sketch helps to clarify:
    readonly readonly readonly [inline editable] readonly
    readonly readonly readonly readonly readonly [another
    inline editable]
    readonly readonly readonly readonly
    As indicated, an editable fragment should possibly line wrap, though this feature may be dispensable.
    Editable fragments should be highlighted and resize on edit as needed. The CppEditor way would be perfect.

    I can't see how to accomplish this out-of-Qt's-box. Is it already provided somehow? Is there additional work available elsewhere that provides such a widget? Else, how would you approach this task if you'd implement it yourself?

    Thank you for your ideas.

    (I apologize for not digging into Qt Creator's source code beforehand... Looking for a shortcut. )

  2. #2
    Join Date
    Jun 2006
    Posts
    81
    Thanks
    6
    Thanked 5 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Inline edit of multiline text widget?

    anyone...?

  3. #3
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    503
    Thanks
    11
    Thanked 76 Times in 74 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Inline edit of multiline text widget?

    Hi, maybe you can play with the cursor positions: each time the cursor is moved to a non-editable area, move it to the end or start of the nearest editable section. Or you can try to mark the editable sections using the QTextDocument which is used by a QTextEdit.

    Ginsengelf

  4. #4
    Join Date
    Jun 2006
    Posts
    81
    Thanks
    6
    Thanked 5 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Inline edit of multiline text widget?

    Thx for your input, Ginsengelf.

    Sure, I'd have to manage a list of editable QTextFragments somehow. The somehow is my question; I'd rather not do this explicitly. As for the readonly, once I have that list, to filter edit events shouldn't be a big deal. The highlighting part troubles me most for now.

    Downloaded the QtCreator sources and tried to extract what I need. However I am completely overwhelmed by the sheer size, just as I feared in the first place.

    Still open for more...

Similar Threads

  1. save line edit text to tabel widget row
    By akhilteja in forum Newbie
    Replies: 3
    Last Post: 24th August 2013, 10:06
  2. multiline text on QPainter
    By amitpatel22 in forum Qt Programming
    Replies: 3
    Last Post: 17th July 2011, 21:42
  3. Replies: 2
    Last Post: 17th October 2010, 13:16
  4. Multiline in QAction text
    By skimpax in forum Qt Programming
    Replies: 5
    Last Post: 15th October 2009, 18:58
  5. Lists/multiline text in QTableView cells
    By dv_ in forum Qt Programming
    Replies: 1
    Last Post: 23rd June 2008, 00:43

Tags for this Thread

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.