diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
index ea93c068..8b479661 100644
--- a/example/CMakeLists.txt
+++ b/example/CMakeLists.txt
@@ -20,7 +20,7 @@ endif()
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
#设置版本号
-add_definitions(-DVERSION=1,2,9,0)
+add_definitions(-DVERSION=1,3,0,0)
find_package(Qt6 REQUIRED COMPONENTS Quick REQUIRED)
diff --git a/example/qml/window/main.qml b/example/qml/TestWindow.qml
similarity index 92%
rename from example/qml/window/main.qml
rename to example/qml/TestWindow.qml
index e466a8e3..0f33e73f 100644
--- a/example/qml/window/main.qml
+++ b/example/qml/TestWindow.qml
@@ -1,7 +1,7 @@
import QtQuick
import FluentUI
-Window {
+FluWindow {
id:window
width: 400
height: 400
diff --git a/example/qml/component/CodeExpander.qml b/example/qml/component/CodeExpander.qml
index 6d69d480..0fdc5436 100644
--- a/example/qml/component/CodeExpander.qml
+++ b/example/qml/component/CodeExpander.qml
@@ -121,7 +121,8 @@ FluExpander{
"FluRatingControl",
"FluPasswordBox",
"FluBreadcrumbBar",
- "FluCopyableText"
+ "FluCopyableText",
+ "FluAcrylic"
];
code = code.replace(/\n/g, "
");
code = code.replace(/ /g, " ");
diff --git a/example/qml/global/ItemsOriginal.qml b/example/qml/global/ItemsOriginal.qml
index 499cc554..a7cffad2 100644
--- a/example/qml/global/ItemsOriginal.qml
+++ b/example/qml/global/ItemsOriginal.qml
@@ -246,6 +246,12 @@ FluObject{
FluPaneItemExpander{
title:lang.theming
icon:FluentIcons.Brightness
+ FluPaneItem{
+ title:"Acrylic"
+ onTap:{
+ navigationView.push("qrc:/example/qml/page/T_Acrylic.qml")
+ }
+ }
FluPaneItem{
title:"Theme"
onTap:{
diff --git a/example/qml/page/T_Acrylic.qml b/example/qml/page/T_Acrylic.qml
new file mode 100644
index 00000000..02be5728
--- /dev/null
+++ b/example/qml/page/T_Acrylic.qml
@@ -0,0 +1,60 @@
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.Window
+import QtQuick.Controls
+import FluentUI
+import "../component"
+
+FluScrollablePage{
+
+ title:"Acrylic"
+
+ FluArea{
+ Layout.fillWidth: true
+ Layout.topMargin: 20
+ height: 1439/5+20
+ paddings: 10
+
+ FluRectangle{
+ width: 1080/5
+ height: 1439/5
+ radius:[25,25,25,25]
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.leftMargin: 20
+ Image {
+ asynchronous: true
+ source: "qrc:/example/res/image/image_huoyin.webp"
+ anchors.fill: parent
+ sourceSize: Qt.size(width,height)
+ FluAcrylic {
+ anchors.centerIn: parent
+ width: 100
+ height: 100
+ FluText {
+ anchors.centerIn: parent
+ text: "Acrylic"
+ color: "#FFFFFF"
+ font.bold: true
+ }
+ }
+ }
+ }
+ }
+ CodeExpander{
+ Layout.fillWidth: true
+ Layout.topMargin: -1
+ code:'Image{
+ width: 800
+ height: 600
+ source: "qrc:/example/res/image/image_huoyin.webp"
+ radius: 8
+ FluAcrylic{
+ width: 100
+ height: 100
+ anchors.centerIn: parent
+ }
+}'
+ }
+
+}
diff --git a/example/qml/window/AboutWindow.qml b/example/qml/window/AboutWindow.qml
index fd8f3795..74266343 100644
--- a/example/qml/window/AboutWindow.qml
+++ b/example/qml/window/AboutWindow.qml
@@ -15,15 +15,9 @@ FluWindow {
maximumHeight: 600
launchMode: FluWindow.SingleTask
- FluAppBar{
- id:appbar
- title:"关于"
- width:parent.width
- }
-
ColumnLayout{
anchors{
- top: appbar.bottom
+ top: parent.top
left: parent.left
right: parent.right
}
diff --git a/example/qml/window/LoginWindow.qml b/example/qml/window/LoginWindow.qml
index 84d8274c..41dbc9f7 100644
--- a/example/qml/window/LoginWindow.qml
+++ b/example/qml/window/LoginWindow.qml
@@ -20,12 +20,6 @@ FluWindow {
textbox_password.focus = true
}
- FluAppBar{
- id:appbar
- title:"登录"
- width:parent.width
- }
-
ColumnLayout{
anchors{
left: parent.left
diff --git a/example/qml/window/MainWindow.qml b/example/qml/window/MainWindow.qml
index 505a445b..4904cee5 100644
--- a/example/qml/window/MainWindow.qml
+++ b/example/qml/window/MainWindow.qml
@@ -31,14 +31,6 @@ FluWindow {
}
}
- FluAppBar{
- id:appbar
- z:9
- showDark: true
- width:parent.width
- darkText: lang.dark_mode
- }
-
SystemTrayIcon {
id:system_tray
visible: true
diff --git a/example/qml/window/MediaWindow.qml b/example/qml/window/MediaWindow.qml
index 3f57288f..d16956ad 100644
--- a/example/qml/window/MediaWindow.qml
+++ b/example/qml/window/MediaWindow.qml
@@ -16,18 +16,12 @@ FluWindow {
player.source = argument.source
}
- FluAppBar{
- id:appbar
- title:"视频播放器"
- width:parent.width
- }
-
FluMediaPlayer{
id:player
anchors{
left: parent.left
right: parent.right
- top: appbar.bottom
+ top: parent.top
bottom: parent.bottom
}
}
diff --git a/example/qml/window/SingleInstanceWindow.qml b/example/qml/window/SingleInstanceWindow.qml
index caae291b..4fad5527 100644
--- a/example/qml/window/SingleInstanceWindow.qml
+++ b/example/qml/window/SingleInstanceWindow.qml
@@ -15,12 +15,6 @@ FluWindow {
maximumHeight: 600
launchMode: FluWindow.SingleInstance
- FluAppBar{
- id:appbar
- title:"SingleInstance"
- width:parent.width
- }
-
FluTextBox{
anchors{
top:parent.top
diff --git a/example/qml/window/SingleTaskWindow.qml b/example/qml/window/SingleTaskWindow.qml
index 70bfa90b..510195b2 100644
--- a/example/qml/window/SingleTaskWindow.qml
+++ b/example/qml/window/SingleTaskWindow.qml
@@ -15,12 +15,6 @@ FluWindow {
maximumHeight: 600
launchMode: FluWindow.SingleTask
- FluAppBar{
- id:appbar
- title:"SingleTask"
- width:parent.width
- }
-
FluText{
anchors.centerIn: parent
text:"我是一个SingleTask模式的窗口,如果我存在,我就激活窗口"
diff --git a/example/qml/window/StandardWindow.qml b/example/qml/window/StandardWindow.qml
index f5f3508c..5fe6f795 100644
--- a/example/qml/window/StandardWindow.qml
+++ b/example/qml/window/StandardWindow.qml
@@ -15,12 +15,6 @@ FluWindow {
maximumHeight: 600
launchMode: FluWindow.Standard
- FluAppBar{
- id:appbar
- title:"Standard"
- width:parent.width
- }
-
FluText{
anchors.centerIn: parent
text:"我是一个Standard模式的窗口,每次我都会创建一个新的窗口"
diff --git a/example/src/main.cpp b/example/src/main.cpp
index 8663e40b..e7bf88f8 100644
--- a/example/src/main.cpp
+++ b/example/src/main.cpp
@@ -45,7 +45,7 @@ int main(int argc, char *argv[])
});
context->setContextProperty("appInfo",appInfo);
const QUrl url(QStringLiteral("qrc:/example/qml/App.qml"));
-// const QUrl url(QStringLiteral("qrc:/example/qml/window/main.qml"));
+// const QUrl url(QStringLiteral("qrc:/example/qml/TestWindow.qml"));
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
&app, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2491f79e..45a40648 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -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
diff --git a/src/FluTools.cpp b/src/FluTools.cpp
index 8307a639..837605b9 100644
--- a/src/FluTools.cpp
+++ b/src/FluTools.cpp
@@ -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;
+}
+
+
diff --git a/src/FluTools.h b/src/FluTools.h
index 5264a860..0033d235 100644
--- a/src/FluTools.h
+++ b/src/FluTools.h
@@ -2,6 +2,7 @@
#define FLUTOOLS_H
#include
+#include
#include
/**
@@ -34,6 +35,13 @@ public:
*/
Q_INVOKABLE QString uuid();
+ /**
+ * @brief readFile 读取文件内容
+ * @param fileName
+ * @return
+ */
+ Q_INVOKABLE QString readFile(const QString &fileName);
+
};
#endif // FLUTOOLS_H
diff --git a/src/imports/FluentUI/Controls/FluAcrylic.qml b/src/imports/FluentUI/Controls/FluAcrylic.qml
new file mode 100644
index 00000000..40062894
--- /dev/null
+++ b/src/imports/FluentUI/Controls/FluAcrylic.qml
@@ -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
+ }
+
+}