main
zhuzihcu 2023-05-12 19:26:49 +08:00
parent 0c19164c54
commit e1c6c04013
17 changed files with 129 additions and 54 deletions

View File

@ -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)

View File

@ -1,7 +1,7 @@
import QtQuick
import FluentUI
Window {
FluWindow {
id:window
width: 400
height: 400

View File

@ -121,7 +121,8 @@ FluExpander{
"FluRatingControl",
"FluPasswordBox",
"FluBreadcrumbBar",
"FluCopyableText"
"FluCopyableText",
"FluAcrylic"
];
code = code.replace(/\n/g, "<br>");
code = code.replace(/ /g, "&nbsp;");

View File

@ -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:{

View 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
}
}'
}
}

View File

@ -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
}

View File

@ -20,12 +20,6 @@ FluWindow {
textbox_password.focus = true
}
FluAppBar{
id:appbar
title:"登录"
width:parent.width
}
ColumnLayout{
anchors{
left: parent.left

View File

@ -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

View File

@ -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
}
}

View File

@ -15,12 +15,6 @@ FluWindow {
maximumHeight: 600
launchMode: FluWindow.SingleInstance
FluAppBar{
id:appbar
title:"SingleInstance"
width:parent.width
}
FluTextBox{
anchors{
top:parent.top

View File

@ -15,12 +15,6 @@ FluWindow {
maximumHeight: 600
launchMode: FluWindow.SingleTask
FluAppBar{
id:appbar
title:"SingleTask"
width:parent.width
}
FluText{
anchors.centerIn: parent
text:"我是一个SingleTask模式的窗口如果我存在我就激活窗口"

View File

@ -15,12 +15,6 @@ FluWindow {
maximumHeight: 600
launchMode: FluWindow.Standard
FluAppBar{
id:appbar
title:"Standard"
width:parent.width
}
FluText{
anchors.centerIn: parent
text:"我是一个Standard模式的窗口每次我都会创建一个新的窗口"

View File

@ -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)

View File

@ -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

View File

@ -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;
}

View File

@ -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

View 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
}
}