2024-08-20 23:58:02 +08:00
|
|
|
import QtQuick
|
|
|
|
import Fluent as Fluent
|
|
|
|
|
2024-09-05 22:05:05 +08:00
|
|
|
Fluent.ApplicationWindow {
|
2024-08-20 23:58:02 +08:00
|
|
|
width: 640
|
|
|
|
height: 480
|
|
|
|
visible: true
|
|
|
|
title: qsTr("FluentWindow")
|
2024-09-05 22:05:05 +08:00
|
|
|
appBar {
|
|
|
|
height: 30
|
|
|
|
showDark: true
|
|
|
|
darkClickListener:(button)=>handleDarkChanged(button)
|
|
|
|
closeClickListener: ()=>{dialog_close.open()}
|
|
|
|
z:7
|
|
|
|
}
|
|
|
|
|
|
|
|
Fluent.Button {
|
|
|
|
text: "成功"
|
|
|
|
property int dd: 0
|
|
|
|
onClicked: {
|
|
|
|
showSuccess("This is a success message %1".arg(dd++),2000)
|
|
|
|
}
|
|
|
|
}
|
2024-08-20 23:58:02 +08:00
|
|
|
|
|
|
|
Fluent.Rectangle {
|
2024-08-21 23:26:43 +08:00
|
|
|
x:100
|
|
|
|
y:100
|
2024-08-20 23:58:02 +08:00
|
|
|
width: 100
|
|
|
|
height: 100
|
2024-08-21 23:26:43 +08:00
|
|
|
color:"red"
|
|
|
|
radius:[10,0,10,0]
|
2024-08-20 23:58:02 +08:00
|
|
|
}
|
2024-09-05 22:05:05 +08:00
|
|
|
|
|
|
|
Fluent.ContentDialog{
|
|
|
|
id: dialog_close
|
|
|
|
title: qsTr("Quit")
|
|
|
|
message: qsTr("Are you sure you want to exit the program?")
|
|
|
|
negativeText: qsTr("Minimize")
|
|
|
|
buttonFlags: Fluent.ContentDialogType.NegativeButton | Fluent.ContentDialogType.NeutralButton | Fluent.ContentDialogType.PositiveButton
|
|
|
|
onNegativeClicked: {
|
|
|
|
system_tray.showMessage(qsTr("Friendly Reminder"),qsTr("FluentUI is hidden from the tray, click on the tray to activate the window again"));
|
|
|
|
timer_window_hide_delay.restart()
|
|
|
|
}
|
|
|
|
positiveText: qsTr("Quit")
|
|
|
|
neutralText: qsTr("Cancel")
|
|
|
|
onPositiveClicked:{
|
|
|
|
Fluent.Router.exit(0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function changeDark(){
|
|
|
|
if(Fluent.Theme.dark){
|
|
|
|
Fluent.Theme.darkMode = Fluent.ThemeType.Light
|
|
|
|
}else{
|
|
|
|
Fluent.Theme.darkMode = Fluent.ThemeType.Dark
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function handleDarkChanged(button){
|
|
|
|
if(Fluent.Utilities.isMacos() || !Fluent.Theme.animationEnabled || !fitsAppBarWindows){
|
|
|
|
changeDark()
|
|
|
|
}else{
|
|
|
|
loader_reveal.sourceComponent = com_reveal
|
|
|
|
var target = window.containerItem()
|
|
|
|
var pos = button.mapToItem(target,0,0)
|
|
|
|
var mouseX = pos.x + button.width / 2
|
|
|
|
var mouseY = pos.y + button.height / 2
|
|
|
|
var radius = Math.max(distance(mouseX,mouseY,0,0),distance(mouseX,mouseY,target.width,0),distance(mouseX,mouseY,0,target.height),distance(mouseX,mouseY,target.width,target.height))
|
|
|
|
var reveal = loader_reveal.item
|
|
|
|
reveal.start(reveal.width*Screen.devicePixelRatio,reveal.height*Screen.devicePixelRatio,Qt.point(mouseX,mouseY),radius)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Fluent.FpsItem {
|
|
|
|
id:fps_item
|
|
|
|
}
|
|
|
|
|
|
|
|
Fluent.Text{
|
|
|
|
text: "fps %1".arg(fps_item.fps)
|
|
|
|
opacity: 0.3
|
|
|
|
anchors{
|
|
|
|
bottom: parent.bottom
|
|
|
|
right: parent.right
|
|
|
|
bottomMargin: 5
|
|
|
|
rightMargin: 5
|
|
|
|
}
|
|
|
|
}
|
2024-08-20 23:58:02 +08:00
|
|
|
}
|