mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-05 17:55:25 +08:00
update
This commit is contained in:
@ -13,9 +13,9 @@ endif()
|
||||
set(QML_PLUGIN_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI)
|
||||
|
||||
#设置版本号
|
||||
add_definitions(-DVERSION=1,2,9,0)
|
||||
add_definitions(-DVERSION=1,3,0,0)
|
||||
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml)
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core Quick Qml ShaderTools)
|
||||
|
||||
#遍历所有Cpp文件
|
||||
file(GLOB_RECURSE CPP_FILES *.cpp *.h)
|
||||
@ -32,7 +32,7 @@ foreach(filepath ${QML_PATHS})
|
||||
endforeach(filepath)
|
||||
|
||||
#遍历所有资源文件
|
||||
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp *.metainfo)
|
||||
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp *.qsb *.metainfo)
|
||||
foreach(filepath ${RES_PATHS})
|
||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||
list(APPEND resource_files ${filename})
|
||||
@ -59,7 +59,6 @@ qt_add_qml_module(fluentuiplugin
|
||||
DESIGNER_SUPPORTED
|
||||
)
|
||||
|
||||
|
||||
#链接库
|
||||
target_link_libraries(fluentuiplugin PUBLIC
|
||||
Qt::Core
|
||||
|
@ -27,3 +27,16 @@ void FluTools::clipText(const QString& text){
|
||||
QString FluTools::uuid(){
|
||||
return QUuid::createUuid().toString();
|
||||
}
|
||||
|
||||
QString FluTools::readFile(const QString &fileName)
|
||||
{
|
||||
QString content;
|
||||
QFile file(fileName);
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
QTextStream stream(&file);
|
||||
content = stream.readAll();
|
||||
}
|
||||
return content;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define FLUTOOLS_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QFile>
|
||||
#include <QtQml/qqml.h>
|
||||
|
||||
/**
|
||||
@ -34,6 +35,13 @@ public:
|
||||
*/
|
||||
Q_INVOKABLE QString uuid();
|
||||
|
||||
/**
|
||||
* @brief readFile 读取文件内容
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
Q_INVOKABLE QString readFile(const QString &fileName);
|
||||
|
||||
};
|
||||
|
||||
#endif // FLUTOOLS_H
|
||||
|
32
src/imports/FluentUI/Controls/FluAcrylic.qml
Normal file
32
src/imports/FluentUI/Controls/FluAcrylic.qml
Normal file
@ -0,0 +1,32 @@
|
||||
import QtQuick
|
||||
import Qt5Compat.GraphicalEffects
|
||||
import FluentUI
|
||||
|
||||
Item {
|
||||
id: control
|
||||
|
||||
property alias color: rect.color
|
||||
property alias acrylicOpacity: rect.opacity
|
||||
|
||||
Rectangle {
|
||||
id: rect
|
||||
anchors.fill: parent
|
||||
color: "white"
|
||||
opacity: 0.05
|
||||
}
|
||||
|
||||
ShaderEffectSource {
|
||||
id: effect_source
|
||||
anchors.fill: parent
|
||||
sourceItem: control.parent
|
||||
sourceRect: Qt.rect(control.x, control.y, control.width, control.height)
|
||||
}
|
||||
|
||||
GaussianBlur {
|
||||
radius: 20
|
||||
anchors.fill: effect_source
|
||||
source: effect_source
|
||||
samples: 1 + radius * 2
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user