FluentUI/src/FluTools.h

60 lines
1.1 KiB
C
Raw Normal View History

2023-05-22 16:17:51 +08:00
#ifndef FLUTOOLS_H
2023-04-27 17:29:39 +08:00
#define FLUTOOLS_H
#include <QObject>
2023-05-12 19:26:49 +08:00
#include <QFile>
2023-04-27 17:29:39 +08:00
#include <QtQml/qqml.h>
/**
* @brief The FluTools class
*/
class FluTools : public QObject
{
Q_OBJECT
QML_NAMED_ELEMENT(FluTools)
QML_SINGLETON
2023-05-11 18:24:58 +08:00
private:
2023-04-27 17:29:39 +08:00
explicit FluTools(QObject *parent = nullptr);
2023-05-11 18:24:58 +08:00
static FluTools* m_instance;
public:
static FluTools *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
{
return getInstance();
}
static FluTools *getInstance();
2023-04-27 17:29:39 +08:00
/**
* @brief clipText
* @param text
*/
Q_INVOKABLE void clipText(const QString& text);
/**
* @brief uuid uuid
* @return
*/
Q_INVOKABLE QString uuid();
2023-05-12 19:26:49 +08:00
/**
* @brief readFile
* @param fileName
* @return
*/
Q_INVOKABLE QString readFile(const QString &fileName);
2023-05-18 20:57:57 +08:00
Q_INVOKABLE bool isMacos();
Q_INVOKABLE bool isLinux();
Q_INVOKABLE bool isWin();
2023-05-31 15:39:59 +08:00
Q_INVOKABLE void setQuitOnLastWindowClosed(bool val);
2023-06-25 23:17:44 +08:00
Q_INVOKABLE int qtMajor();
Q_INVOKABLE int qtMinor();
2023-04-27 17:29:39 +08:00
};
#endif // FLUTOOLS_H