fileio.h 661 B

12345678910111213141516171819202122232425262728293031323334
  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 = 0);
  13. Q_INVOKABLE QString read();
  14. Q_INVOKABLE bool write(const QString& data);
  15. QString source() { return mSource; };
  16. public slots:
  17. void setSource(const QString& source) { mSource = source; };
  18. signals:
  19. void sourceChanged(const QString& source);
  20. void error(const QString& msg);
  21. private:
  22. QString mSource;
  23. };
  24. #endif // FILEIO_H