This commit is contained in:
zhuzichu
2023-07-21 18:58:09 +08:00
parent 2b88634c2f
commit 4d78262277
8 changed files with 68 additions and 46 deletions

View File

@ -93,6 +93,11 @@ qt_add_qml_module(example
RESOURCES ${resource_files}
)
#导入component头文件,不然通过QML_NAMED_ELEMENT生成的c++类会找不到头文件报错
target_include_directories(example PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/component
)
#设置属性
set_target_properties(example PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com

View File

@ -11,6 +11,9 @@ FluScrollablePage{
title:"Http"
Component.onDestruction: {
console.debug("T_Http -> onDestruction")
}
FluHttp{
id:http_get
@ -66,6 +69,7 @@ FluScrollablePage{
onDownloadProgress:
(recv,total)=>{
var precent = (recv/total * 100).toFixed(0) + "%"
console.debug(precent)
btn_download.text = "下载中..."+precent
}
onError:

View File

@ -12,6 +12,7 @@ class CircularReveal : public QQuickPaintedItem
Q_OBJECT
Q_PROPERTY_AUTO(QQuickItem*,target)
Q_PROPERTY_AUTO(int,radius)
QML_NAMED_ELEMENT(CircularReveal)
public:
CircularReveal(QQuickItem* parent = nullptr);
void paint(QPainter* painter) override;

View File

@ -3,12 +3,14 @@
#include <QObject>
#include <QFileSystemWatcher>
#include <QtQml/qqml.h>
#include "src/stdafx.h"
class FileWatcher : public QObject
{
Q_OBJECT
Q_PROPERTY_AUTO(QString,path);
QML_NAMED_ELEMENT(FileWatcher)
public:
explicit FileWatcher(QObject *parent = nullptr);
Q_SIGNAL void fileChanged();

View File

@ -8,8 +8,6 @@
#include <QProcess>
#include <FramelessHelper/Quick/framelessquickmodule.h>
#include <FramelessHelper/Core/private/framelessconfig_p.h>
#include "src/component/CircularReveal.h"
#include "src/component/FileWatcher.h"
#include "AppInfo.h"
FRAMELESSHELPER_USE_NAMESPACE
@ -39,8 +37,6 @@ FRAMELESSHELPER_USE_NAMESPACE
#ifdef FLUENTUI_BUILD_STATIC_LIB
engine.addImportPath("qrc:/"); // 让静态资源可以被QML引擎搜索到
#endif
qmlRegisterType<CircularReveal>("example", 1, 0, "CircularReveal");
qmlRegisterType<FileWatcher>("example", 1, 0, "FileWatcher");
appInfo->init(&engine);
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,