Results 1 to 12 of 12

Thread: I want to get lines of text

Threaded View

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

    Default I want to get lines of text

    I wrote opening file and showing subject of file in textedit - function:
    Qt Code:
    1. void MyWindow::Open ()
    2. {
    3. QString nameFile = QFileDialog::getOpenFileName (this);
    4.  
    5. if (!nameFile.isEmpty ())
    6. {
    7. QFile file (nameFile);
    8.  
    9. if (file.open (QFile::ReadOnly | QFile::Text))
    10. {
    11. QTextStream in (&file);
    12. textEdit1 -> setPlainText (in.readAll ());
    13. file.close();
    14. }
    15.  
    16. }
    17. }
    To copy to clipboard, switch view to plain text mode 

    But I want to take one line of text. How can I take one line of text ? Because I want to sort lines of text, for example - first:

    bbb bbb aaa
    bbb aaa cc
    aaa gg

    Then it will be:

    aaa gg
    bbb aaa cc
    bbb bbb aaa

    I need to take one line of text - here it is "bbb bbb aaa", then I will trow it into vector (from library STL from c++), then I will use function sort() (from library STL from c++) and I will get sorted lines of text.

    BUT HOW CAN I TAKE ONE LINE OF TEXT FROM FILE ?
    Last edited by jacek; 28th July 2008 at 22:12. Reason: changed [qtclass] to [code]

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.