QFile file(nameFile); if( file.exists() ){ if( !file.open(QIODevice::ReadOnly ) ){ qDebug()<<" Erorr : can not open file for reading ."; } int n=0; while( !file.readLine().isEmpty() ){ n++; } }