Hi everyone. I'm new here and I hope that someone can help me. I don't know what I'm doing wrong. My problem is that I am referring to a directory with 10 files but the function files() of QFileSystemWatcher class give me back a empty list. That's my code:

UploadDeleteFile.hpp

Qt Code:
  1. #ifndef UPLOADDELETEFILE_HPP_
  2. #define UPLOADDELETEFILE_HPP_
  3.  
  4. #include "TestScheduler.hpp"
  5. #include "accountInfoSettings.hpp"
  6. #include <QFileSystemWatcher>
  7. #include <QObject>
  8. #include <QStringList>
  9.  
  10. class UploadDeleteFile : public QObject{
  11.  
  12. Q_OBJECT
  13.  
  14. public:
  15. UploadDeleteFile(QObject *parent, TestScheduler *myTestScheduler, accountInfoSettings *myAccountInfoSettings);
  16. virtual ~UploadDeleteFile();
  17.  
  18. QStringList getFileNameList();
  19. Q_INVOKABLE void setFileNameList();
  20.  
  21. accountInfoSettings *accountInfo;
  22. QFileSystemWatcher fileSystem;
  23. TestScheduler *testScheduler;
  24. QStringList filelist;
  25. QString filename;
  26. int index;
  27. };
  28.  
  29. #endif /* UPLOADDELETEFILE_HPP_ */
To copy to clipboard, switch view to plain text mode 


UploadDeleteFile.cpp

Qt Code:
  1. #include "FileUploader.hpp"
  2. #include "MessageComposer.hpp"
  3. #include "UploadDeleteFile.hpp"
  4.  
  5. #include <bb/system/SystemToast>
  6. #include <stdio.h>
  7.  
  8. using namespace bb::cascades;
  9. using namespace bb::pim::account;
  10. using namespace bb::system;
  11.  
  12. UploadDeleteFile::UploadDeleteFile(QObject *parent, TestScheduler *myTestScheduler, accountInfoSettings *myAccountInfoSettings): QObject(parent) {
  13. // TODO Auto-generated constructor stub
  14. testScheduler = myTestScheduler;
  15. accountInfo = myAccountInfoSettings;
  16. index = -1;
  17. filename = "";
  18. filelist = QStringList();
  19. }
  20.  
  21. UploadDeleteFile::~UploadDeleteFile() {
  22. // TODO Auto-generated destructor stub
  23. }
  24.  
  25. void UploadDeleteFile::setFileName(QString name){
  26. filename = name;
  27. }
  28.  
  29. void UploadDeleteFile::setFileNameList(){
  30. fileSystem.addPath("data/Tests/");
  31. QStringList directories = fileSystem.directories();
  32. filelist = fileSystem.files();
  33. }
  34.  
  35. QStringList UploadDeleteFile::getFileNameList(){
  36. return filelist;
  37. }
To copy to clipboard, switch view to plain text mode 

Any help is welcome. Thanks Carmen