View Single Post
nicolai's Avatar
Posts: 1,637 | Thanked: 4,424 times | Joined on Apr 2009 @ Germany
#122
Originally Posted by D-Iivil View Post
I have included the QTextStream in header among others:
#include <QtCore>
#include <QMainWindow>
#include <QProgressDialog>
#include <QColorDialog>
#include <QHash>
#include <QFile>
#include <QTextStream>

But still have the errors.
Ah, funny bug:

if (!file.open (IO_ReadOnly))
// didn't work
QTextStream stream ( &file );

....
while( !stream.eof() ) {

stream is only declared in the "if-block" scope. The same like this.

if (!file.open (IO_ReadOnly))
QTextStream stream ( &file );

....
while( !stream.eof() ) {

or

if (!file.open (IO_ReadOnly))
{
QTextStream stream ( &file );
}


....
while( !stream.eof() ) {

would produce an error :-)