fileio.h 721 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef FILEIO_H
  2. #define FILEIO_H
  3. #include <QObject>
  4. class FileIO : public QObject
  5. {
  6. Q_OBJECT
  7. public:
  8. Q_PROPERTY(QString source
  9. READ source
  10. WRITE setSource
  11. NOTIFY sourceChanged)
  12. explicit FileIO(QObject *parent = nullptr);
  13. Q_INVOKABLE QString read();
  14. Q_INVOKABLE bool write(const QString& data);
  15. Q_INVOKABLE bool remove(const QString& path);
  16. QString source() { return mSource; }
  17. public slots:
  18. void setSource(const QString& source) { mSource = source; }
  19. signals:
  20. void sourceChanged(const QString& source);
  21. void error(const QString& msg);
  22. private:
  23. QString mSource;
  24. signals:
  25. public slots:
  26. };
  27. #endif // FILEIO_H