Results 1 to 2 of 2

Thread: Find and line endings

  1. #1
    Join Date
    Sep 2006
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Find and line endings

    I am using Qt4.1.4 and writing a simple source text editor based on QTextEdit (actually converting a Qt3 working application but the query is new).

    I have noticed that the text string of a selection spanning a line ending contains a two-byte unicode (0x02920?) where the line break occurs. When this is used in a QTextDocument find the search fails to find identical text spanning a line break or indeed text with the line break code omitted, i.e. any search string of this nature is bound to fail.

    Could someone enlighten me as to the policy here. I know it is unusual for editors to offer this capability, Microsoft's Visual Studio doesn't even allow the line break to get into the search string, but I think it could be quite useful. Now that Qt4's QTextEdit uses block objects to hold lines (paragraphs), dealing with line breaks must already be a bit more complicated than simply coping with 'LF' codes. Could we either prevent special codes getting into text strings, implement code to handle them or flag an error?

    I hope this a new query - difficult to search on it - and thanks in advance for any comments.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Find and line endings

    I suppose you would have to write your own find function. QTextDocument::find() iterates through appropriate blocks and performs the search on every block, one by one. Therefore a string covering multiple blocks is not found.
    J-P Nurmi

Similar Threads

  1. Find function in Qt ?
    By npc in forum Newbie
    Replies: 3
    Last Post: 9th May 2006, 10:06
  2. Replies: 17
    Last Post: 31st March 2006, 05:57
  3. Cannot find line or rectangle widget
    By Kapil in forum Newbie
    Replies: 3
    Last Post: 23rd February 2006, 11:01

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.