databasethread.h 550 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef DATABASETHREAD_H
  2. #define DATABASETHREAD_H
  3. #include <QThread>
  4. #include <QDateTime>
  5. #include <QSqlDatabase>
  6. #include <QSqlQuery>
  7. #include <QVariant>
  8. #include <QStringList>
  9. class DatabaseThread : public QThread
  10. {
  11. Q_OBJECT
  12. public:
  13. explicit DatabaseThread(QObject *parent,QSqlDatabase *db);
  14. void run();
  15. void stop();
  16. void appendSql(QString sql);
  17. signals:
  18. void dbdata_log(QString log);
  19. public slots:
  20. private:
  21. int hour;
  22. bool keep;
  23. QSqlDatabase *Db;
  24. QStringList sqlList;
  25. };
  26. #endif // DATABASETHREAD_H