Hi all,
Firstly being new on this forum, i quickly present myself. My Name is John, i'm 25 and i'm a french student to an IT engineering school.
I'm currently trying to develop a simple QT C++ 11 program to compress all files contained into a directory.
I want to use qCompress from QByteArray class to do this trick.

I got to do it in a single threaded environment, so now i want to compress in a multi threaded environment by using QtConcurrent.

But i have no idea on how to do it properly.

Here a draft i written :

Qt Code:
  1. QFile outFile("testCompress.ecf");
  2. outFile.open(QIODevice::WriteOnly);
  3. QByteArray nonCompressedData;
  4. foreach(const QString &file,future.results()){
  5. //Fichier d'entrée
  6. QFile inFile(file);
  7. inFile.open(QIODevice::ReadOnly);
  8. nonCompressedData.append(inFile.readAll());
  9. inFile.close();
  10. text += file + "\n";
  11. }
  12.  
  13. //QByteArray compressedData(qCompress(nonCompressedData,9));
  14. //PROBLEM HERE
  15. QFuture<QByteArray> futureCompressor = QtConcurrent::filtered(nonCompressedData,qCompress);
  16. futureCompressor.waitForFinished();
  17. QByteArray compressedData = futureCompressor.results();
  18.  
  19. outFile.write(compressedData);
To copy to clipboard, switch view to plain text mode 

But i have some compilation errors.

I think it is a bad way to do this so i need some help to go on the right way.

Compilations errors :

First : No matching function for call to filtered(&QByteArray,).

Second : converstion from QList to non scalar type QByteArray requested.

Thanks in advance