Guest User

Untitled

a guest
Jun 25th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. ThreadsCopy threadA("thread A",model->index(i,1).data().toString(),newDir+"/"+QFileInfo(model->index(i,1).data().toString()).fileName());
  2. threadA.start();
  3.  
  4. #ifndef THREADSCOPY_H
  5. #define THREADSCOPY_H
  6.  
  7. #include <QThread>
  8. #include <login.h>
  9. #include <QFile>
  10.  
  11. class ThreadsCopy : public QThread
  12. {
  13. public:
  14. explicit ThreadsCopy(QString threadName, QString fromPath, QString toPath);
  15.  
  16. // Переопределяем метод run(), в котором будет
  17. // располагаться выполняемый код
  18. void run();
  19. QString _fromPath;
  20. QString _toPath;
  21.  
  22. QMessageBox msgBox;
  23.  
  24. private:
  25. QString name; // Имя потока
  26. };
  27.  
  28. #endif // THREADSCOPY_H
  29.  
  30. #include "threadscopy.h"
  31. #include <QDebug>
  32.  
  33. ThreadsCopy::ThreadsCopy(QString threadName, QString fromPath, QString toPath) :
  34. name(threadName),
  35. _fromPath(fromPath),
  36. _toPath(toPath)
  37. {
  38.  
  39. }
  40.  
  41. void ThreadsCopy::run()
  42. {
  43. qDebug()<<name;
  44. qDebug()<<_fromPath;
  45. qDebug()<<_toPath;
  46. QFile::copy(_fromPath,_toPath);
  47. }
Add Comment
Please, Sign In to add comment