FluentUI/example/qml/page/T_Acrylic.qml

115 lines
3.0 KiB
QML
Raw Permalink Normal View History

2023-08-24 15:50:37 +08:00
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import FluentUI 1.0
2023-08-26 17:20:30 +08:00
import "../component"
2023-05-12 19:26:49 +08:00
FluScrollablePage{
2024-03-09 15:35:48 +08:00
title: qsTr("Acrylic")
2023-05-12 19:26:49 +08:00
2023-07-27 17:46:18 +08:00
RowLayout{
2023-07-27 18:13:50 +08:00
spacing: 10
2023-07-27 17:46:18 +08:00
FluText{
2023-07-27 18:13:50 +08:00
text:"tintColor:"
2023-07-27 17:46:18 +08:00
Layout.alignment: Qt.AlignVCenter
}
FluColorPicker{
id:color_picker
}
}
RowLayout{
2023-07-27 18:13:50 +08:00
spacing: 10
2023-07-27 17:46:18 +08:00
FluText{
2023-07-27 18:13:50 +08:00
text:"tintOpacity:"
2023-07-27 17:46:18 +08:00
Layout.alignment: Qt.AlignVCenter
}
FluSlider{
id:slider_tint_opacity
value: 65
}
}
RowLayout{
2023-07-27 18:13:50 +08:00
spacing: 10
2023-07-27 17:46:18 +08:00
FluText{
2023-07-27 18:13:50 +08:00
text:"blurRadius:"
2023-07-27 17:46:18 +08:00
Layout.alignment: Qt.AlignVCenter
}
FluSlider{
id:slider_blur_radius
value: 32
}
}
2024-03-29 16:56:09 +08:00
FluFrame{
2023-05-12 19:26:49 +08:00
Layout.fillWidth: true
2024-03-29 16:23:16 +08:00
Layout.preferredHeight: 1200/4+20
padding: 10
2023-07-27 17:46:18 +08:00
Layout.topMargin: 10
2023-09-17 20:36:33 +08:00
FluClip{
2023-07-27 17:46:18 +08:00
width: 1920/4
height: 1200/4
2023-09-08 22:33:23 +08:00
radius:[8,8,8,8]
2023-05-12 19:26:49 +08:00
Image {
2023-05-14 13:05:06 +08:00
id:image
2023-05-12 19:26:49 +08:00
asynchronous: true
2024-03-31 21:56:11 +08:00
source: "qrc:/example/res/image/bg_scenic.jpg"
2023-05-12 19:26:49 +08:00
anchors.fill: parent
2023-05-17 11:42:03 +08:00
sourceSize: Qt.size(2*width,2*height)
2023-05-14 13:05:06 +08:00
}
FluAcrylic {
2023-07-27 17:46:18 +08:00
id:acrylic
target: image
width: 200
height: 200
tintOpacity: slider_tint_opacity.value/100
2024-03-06 00:34:43 +08:00
tintColor: color_picker.current
2023-07-27 17:46:18 +08:00
blurRadius: slider_blur_radius.value
x:(image.width-width)/2
y:(image.height-height)/2
2023-05-14 13:05:06 +08:00
FluText {
anchors.centerIn: parent
text: "Acrylic"
color: "#FFFFFF"
2024-04-04 01:10:14 +08:00
font: FluTextStyle.Subtitle
2023-05-12 19:26:49 +08:00
}
2023-07-27 17:46:18 +08:00
MouseArea {
property point clickPos: Qt.point(0,0)
id:drag_area
2024-03-02 23:37:25 +08:00
preventStealing: true
2023-07-27 17:46:18 +08:00
anchors.fill: parent
onPressed: (mouse)=>{
clickPos = Qt.point(mouse.x, mouse.y)
}
onPositionChanged: (mouse)=>{
var delta = Qt.point(mouse.x - clickPos.x,mouse.y - clickPos.y)
acrylic.x = acrylic.x + delta.x
acrylic.y = acrylic.y + delta.y
}
}
2023-05-12 19:26:49 +08:00
}
2023-05-12 22:22:55 +08:00
Layout.topMargin: 20
2023-05-12 19:26:49 +08:00
}
2023-05-12 22:22:55 +08:00
2023-05-12 19:26:49 +08:00
}
CodeExpander{
Layout.fillWidth: true
2024-03-29 16:23:16 +08:00
Layout.topMargin: -6
2023-05-12 19:26:49 +08:00
code:'Image{
2023-05-14 13:05:06 +08:00
id:image
2023-05-12 19:26:49 +08:00
width: 800
height: 600
source: "qrc:/example/res/image/image_huoyin.webp"
radius: 8
2023-05-14 13:05:06 +08:00
}
2023-05-12 19:26:49 +08:00
FluAcrylic{
2023-07-27 17:46:18 +08:00
target:image
2023-05-12 19:26:49 +08:00
width: 100
height: 100
anchors.centerIn: parent
2023-06-20 19:02:18 +08:00
}
2023-05-12 19:26:49 +08:00
}'
}
}