Results 1 to 17 of 17

Thread: QStringList to QTextStream

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2012
    Posts
    12
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QStringList to QTextStream

    Script_t is QStringList and it compiles on my VS2010.

  2. #2
    Join Date
    Jan 2008
    Posts
    72
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: QStringList to QTextStream

    Wysota is right , toPlainText() returns QString and not QStringList. So access your each value ,split that string into a stringlist..

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

    Default Re: QStringList to QTextStream

    Quote Originally Posted by Jonathan Maen View Post
    Script_t is QStringList and it compiles on my VS2010.
    Please check that as the application behaves as if it were not a string list.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Jan 2012
    Posts
    12
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QStringList to QTextStream

    So It's been a few days since I've got this problem, and since I'm just 17 years old, and just 2 weeks with C++ and Qt, I'm just learning.

    What's the best way to parse each line of QTextEdit into a QStringList, I really need this in order to add 2 tabs to the beginning of every line of the file.

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

    Default Re: QStringList to QTextStream

    The most basic approach I can think of is:
    Qt Code:
    1. QStringList lines = textEdit->toPlainText().split("\n");
    To copy to clipboard, switch view to plain text mode 

    However that's probably not the best possible way. It would be much better (albeit more complicated) to use QTextDocument API.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. The following user says thank you to wysota for this useful post:

    Jonathan Maen (2nd February 2012)

Similar Threads

  1. Help QStringList
    By pcoliver in forum Qt Programming
    Replies: 0
    Last Post: 15th September 2011, 10:15
  2. Plz help me,I met a bug about QStringList
    By study_c in forum Qt Programming
    Replies: 1
    Last Post: 16th October 2010, 15:56
  3. Replies: 4
    Last Post: 9th August 2009, 01:04
  4. QStringList
    By jaca in forum Qt Programming
    Replies: 5
    Last Post: 17th May 2008, 10:12
  5. Replies: 7
    Last Post: 2nd June 2006, 12:48

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.