databasethread.h 666 B

1234567891011121314151617181920212223242526272829303132333435363738
  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 = nullptr);
  14. void run();
  15. void stop();
  16. void appendSql(QString sql);
  17. void appendAlarm(QString sql);
  18. signals:
  19. void mqtt_conf(QString ip,QString port,QString username,QString password);
  20. void dbdata_log(QString log);
  21. public slots:
  22. private:
  23. int hour;
  24. bool keep;
  25. QSqlDatabase db;
  26. QStringList sqlList,alarmList;
  27. };
  28. #endif // DATABASETHREAD_H