Compare commits

..

2 Commits

Author SHA1 Message Date
Dylan Liu
ff89677687
Merge bd7876b23b into 5cfd9824a8 2024-05-30 01:46:30 +00:00
Mentalflow
bd7876b23b
Project: Add Qt5QMLPlugin and optimize CMakeLists. 2024-05-30 09:46:10 +08:00
2 changed files with 4 additions and 35 deletions

@ -1 +1 @@
Subproject commit f056abc43282cb7b652aa04e3ee3b0a60f2b85f6
Subproject commit c258660e71fb345d6c892719ce638c1f6632e623

View File

@ -19,9 +19,8 @@
#include "src/helper/InitializrHelper.h"
#include "src/helper/TranslateHelper.h"
#include "src/helper/Network.h"
#include <QDirIterator>
#ifdef FLUENTUI_BUILD_STATIC_LIB
#if (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
#define Q_IMPORT_QML_PLUGIN(PLUGIN) \
Q_IMPORT_PLUGIN(PLUGIN)
extern void qml_static_register_types_FluentUI();
@ -32,38 +31,6 @@ Q_IMPORT_QML_PLUGIN(FluentUIPlugin)
#ifdef WIN32
#include "app_dmp.h"
#endif
void listFiles(const QString &path) {
QDir dir(path);
// 设置过滤器以包括目录和文件,排除符号链接
dir.setFilter(QDir::Files | QDir::Dirs);
// 获取目录和文件信息列表
QFileInfoList list = dir.entryInfoList();
for (const QFileInfo &fileInfo : list) {
if (fileInfo.isDir()) {
// 如果是目录则递归调用listFiles
listFiles(fileInfo.absoluteFilePath());
} else {
// 输出文件名称
qDebug() << "文件名: " << fileInfo.fileName();
QFile file(fileInfo.absoluteFilePath());
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
continue;
QTextStream in(&file);
// 输出文件内容
qDebug() << "文件内容: ";
while (!in.atEnd()) {
QString line = in.readLine();
qDebug() << line;
}
file.close();
}
}
}
int main(int argc, char *argv[])
{
const char *uri = "example";
@ -113,7 +80,9 @@ int main(int argc, char *argv[])
qmlRegisterUncreatableMetaObject(NetworkType::staticMetaObject, uri, major, minor, "NetworkType", "Access to enums & flags only");
QQmlApplicationEngine engine;
#ifdef FLUENTUI_BUILD_STATIC_LIB
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
qml_static_register_types_FluentUI();
#endif
#endif
TranslateHelper::getInstance()->init(&engine);
engine.rootContext()->setContextProperty("AppInfo",AppInfo::getInstance());