DPS_Manage/qmltool.h

39 lines
849 B
C
Raw Permalink Normal View History

2025-05-29 14:04:05 +08:00
#ifndef QMLTOOL_H
#define QMLTOOL_H
#include <QObject>
#include <QFile>
#include <QDebug>
#include <QDesktopServices>
#include <QUrl>
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