#ifndef QMLTOOL_H #define QMLTOOL_H #include #include #include #include #include class QmlTool : public QObject { Q_OBJECT private: explicit QmlTool(QObject *parent = nullptr); ~QmlTool(); QmlTool(const QmlTool&) = delete; QmlTool& operator=(const QmlTool&) = delete; static QmlTool* instance; public: static QmlTool* getInstance(); public: // 用于读取文件内容的方法 Q_INVOKABLE QString readFile(const QString& filePath); // 用于写入文件内容的方法 Q_INVOKABLE bool wirteFile(const QString& filePath,const QString& content); //用于打开一个文件 Q_INVOKABLE void openFile(const QString &fileName); //启动另一个程序 Q_INVOKABLE void runExe(const QString &pr); signals: }; #endif // QMLTOOL_H