Results 1 to 6 of 6

Thread: loading a textfile in a qlabel

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2007
    Posts
    33
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default loading a textfile in a qlabel

    hi,

    can anyone tell me why the following code doesn't display the content of the given textfile in the QLabel ?

    Qt Code:
    1. QFile trainResult("26.train");
    2. QTextStream in(&trainResult);
    3.  
    4. trainLabel->setText(in.readAll());
    5. trainLabel->adjustSize();
    To copy to clipboard, switch view to plain text mode 

    26.train is a small textfile, trainLabel a simple QLabel. trainLabel->setText("abc"); works fine...

    thanks in advance
    Last edited by jacek; 11th June 2007 at 19:01. Reason: changed [qtclass] to [code]

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.