mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 03:10:10 +08:00
update
This commit is contained in:
parent
0c19164c54
commit
e1c6c04013
@ -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)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import QtQuick
|
||||
import FluentUI
|
||||
|
||||
Window {
|
||||
FluWindow {
|
||||
id:window
|
||||
width: 400
|
||||
height: 400
|
@ -121,7 +121,8 @@ FluExpander{
|
||||
"FluRatingControl",
|
||||
"FluPasswordBox",
|
||||
"FluBreadcrumbBar",
|
||||
"FluCopyableText"
|
||||
"FluCopyableText",
|
||||
"FluAcrylic"
|
||||
];
|
||||
code = code.replace(/\n/g, "<br>");
|
||||
code = code.replace(/ /g, " ");
|
||||
|
@ -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:{
|
||||
|
60
example/qml/page/T_Acrylic.qml
Normal file
60
example/qml/page/T_Acrylic.qml
Normal file
@ -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
|
||||
}
|
||||
}'
|
||||
}
|
||||
|
||||
}
|
@ -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
|
||||
}
|
||||
|
@ -20,12 +20,6 @@ FluWindow {
|
||||
textbox_password.focus = true
|
||||
}
|
||||
|
||||
FluAppBar{
|
||||
id:appbar
|
||||
title:"登录"
|
||||
width:parent.width
|
||||
}
|
||||
|
||||
ColumnLayout{
|
||||
anchors{
|
||||
left: parent.left
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -15,12 +15,6 @@ FluWindow {
|
||||
maximumHeight: 600
|
||||
launchMode: FluWindow.SingleInstance
|
||||
|
||||
FluAppBar{
|
||||
id:appbar
|
||||
title:"SingleInstance"
|
||||
width:parent.width
|
||||
}
|
||||
|
||||
FluTextBox{
|
||||
anchors{
|
||||
top:parent.top
|
||||
|
@ -15,12 +15,6 @@ FluWindow {
|
||||
maximumHeight: 600
|
||||
launchMode: FluWindow.SingleTask
|
||||
|
||||
FluAppBar{
|
||||
id:appbar
|
||||
title:"SingleTask"
|
||||
width:parent.width
|
||||
}
|
||||
|
||||
FluText{
|
||||
anchors.centerIn: parent
|
||||
text:"我是一个SingleTask模式的窗口,如果我存在,我就激活窗口"
|
||||
|
@ -15,12 +15,6 @@ FluWindow {
|
||||
maximumHeight: 600
|
||||
launchMode: FluWindow.Standard
|
||||
|
||||
FluAppBar{
|
||||
id:appbar
|
||||
title:"Standard"
|
||||
width:parent.width
|
||||
}
|
||||
|
||||
FluText{
|
||||
anchors.centerIn: parent
|
||||
text:"我是一个Standard模式的窗口,每次我都会创建一个新的窗口"
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user