Results 1 to 12 of 12

Thread: I want to get lines of text

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2008
    Posts
    25
    Qt products
    Qt4
    Thanks
    4

    Default Re: I want to get lines of text

    Thx you very much JimDaniel, I didn't know about 'QStringList' in Qt Thx !!


    I have a little problem with ENTER's ( '\n' ) and function 'append()'. When I have for example:
    a
    b
    c
    d

    After used 'append' I see in my textbox:
    a

    b

    c

    d

    Why ? Is it any function in Qt which resolve this problem ?

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

    Default Re: I want to get lines of text

    What code are u using to append ?? You are probably appending '\n' too.

  3. #3
    Join Date
    Jul 2008
    Posts
    25
    Qt products
    Qt4
    Thanks
    4

    Default Re: I want to get lines of text


  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    8
    Thanked 334 Times in 317 Posts

    Default Re: I want to get lines of text

    You shouldnt probably be getting that..
    From the docs -
    QString QTextStream::readLine ( qint64 maxlen = 0 )
    Reads one line of text from the stream, and returns it as a QString. The maximum allowed line length is set to maxlen. If the stream contains lines longer than this, then the lines will be split after maxlen characters and returned in parts.
    If maxlen is 0, the lines can be of any length. A common value for maxlen is 75.
    The returned line has no trailing end-of-line characters ("\n" or "\r\n"), so calling QString::trimmed() is unnecessary.
    Hence \n must not be present in the string list.
    Can you manually check the QString -> list.at(i) .... what does it contain ?

  5. The following user says thank you to aamer4yu for this useful post:

    newplayer (29th July 2008)

  6. #5
    Join Date
    Jul 2008
    Posts
    25
    Qt products
    Qt4
    Thanks
    4

    Default Re: I want to get lines of text

    Thx - trimmed() helped me

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Replies: 4
    Last Post: 25th May 2008, 20:01
  3. Match the text beetween two string
    By dreamer in forum Qt Programming
    Replies: 4
    Last Post: 20th May 2008, 14:48
  4. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 12:05
  5. Editable text in QGraphicsView
    By wysota in forum Qt Programming
    Replies: 8
    Last Post: 24th February 2007, 15:30

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
  •  
Qt is a trademark of The Qt Company.