mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2025-07-02 16:15:28 +08:00
update
This commit is contained in:
@ -7,7 +7,7 @@ import FluentUI 1.0
|
||||
Rectangle{
|
||||
|
||||
property string title: "标题"
|
||||
property color textColor: FluTheme.isDark ? "#000000" : "#FFFFFF"
|
||||
property color textColor: FluTheme.isDark ? "#FFFFFF" : "#000000"
|
||||
property bool showDark: false
|
||||
property bool showFps: false
|
||||
property var window: Window.window
|
||||
@ -20,13 +20,9 @@ Rectangle{
|
||||
}
|
||||
|
||||
id:root
|
||||
color: {
|
||||
if(Window.window == null)
|
||||
return borerlessColor
|
||||
return Window.window.active ? borerlessColor : Qt.lighter(borerlessColor,1.1)
|
||||
}
|
||||
color: Qt.rgba(0,0,0,0)
|
||||
visible: FluTheme.isFrameless
|
||||
height: visible ? 34 : 0
|
||||
height: visible ? 30 : 0
|
||||
width: {
|
||||
if(parent==null)
|
||||
return 200
|
||||
@ -62,7 +58,7 @@ Rectangle{
|
||||
|
||||
RowLayout{
|
||||
anchors.right: parent.right
|
||||
height: 30
|
||||
height: root.height
|
||||
spacing: 0
|
||||
|
||||
TFpsMonitor{
|
||||
@ -92,10 +88,13 @@ Rectangle{
|
||||
}
|
||||
|
||||
FluIconButton{
|
||||
iconSource : FluentIcons.ChromeMinimizeContrast
|
||||
width: 40
|
||||
height: 30
|
||||
iconSource : FluentIcons.ChromeMinimize
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
iconSize: 15
|
||||
iconSize: 11
|
||||
text:"最小化"
|
||||
radius: 0
|
||||
textColor: root.textColor
|
||||
color:hovered ? "#20000000" : "#00000000"
|
||||
onClicked: {
|
||||
@ -103,41 +102,41 @@ Rectangle{
|
||||
}
|
||||
}
|
||||
FluIconButton{
|
||||
width: 40
|
||||
height: 30
|
||||
property bool isRestore:{
|
||||
if(window == null)
|
||||
return false
|
||||
return Window.Maximized === window.visibility
|
||||
}
|
||||
iconSource : isRestore ? FluentIcons.ChromeRestoreContrast : FluentIcons.ChromeMaximizeContrast
|
||||
iconSource : isRestore ? FluentIcons.ChromeRestore : FluentIcons.ChromeMaximize
|
||||
color:hovered ? "#20000000" : "#00000000"
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
visible: resizable
|
||||
radius: 0
|
||||
textColor: root.textColor
|
||||
text:isRestore?"向下还原":"最大化"
|
||||
iconSize: 15
|
||||
iconSize: 11
|
||||
onClicked: {
|
||||
toggleMaximized()
|
||||
}
|
||||
}
|
||||
FluIconButton{
|
||||
iconSource : FluentIcons.ChromeCloseContrast
|
||||
iconSource : FluentIcons.ChromeClose
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
text:"关闭"
|
||||
iconSize: 13
|
||||
textColor: root.textColor
|
||||
color:hovered ? "#20000000" : "#00000000"
|
||||
width: 40
|
||||
height: 30
|
||||
radius: 0
|
||||
iconSize: 10
|
||||
textColor: hovered ? Qt.rgba(1,1,1,1) : root.textColor
|
||||
color:hovered ? Qt.rgba(251/255,115/255,115/255,1) : "#00000000"
|
||||
onClicked: {
|
||||
Window.window.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluDivider{
|
||||
width: parent.width;
|
||||
height: 1;
|
||||
anchors.bottom: parent.bottom;
|
||||
}
|
||||
|
||||
function toggleMaximized() {
|
||||
if(!resizable)
|
||||
return
|
||||
|
@ -7,6 +7,7 @@ Button {
|
||||
property int iconSize: 20
|
||||
property int iconSource
|
||||
property bool disabled: false
|
||||
property int radius:4
|
||||
property color hoverColor: FluTheme.isDark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(0,0,0,0.03)
|
||||
property color normalColor: FluTheme.isDark ? Qt.rgba(0,0,0,0) : Qt.rgba(0,0,0,0)
|
||||
property color disableColor: FluTheme.isDark ? Qt.rgba(59/255,59/255,59/255,1) : Qt.rgba(0,0,0,0)
|
||||
@ -40,7 +41,7 @@ Button {
|
||||
focusPolicy:Qt.TabFocus
|
||||
Keys.onSpacePressed: control.visualFocus&&clicked()
|
||||
background: Rectangle{
|
||||
radius: 4
|
||||
radius: control.radius
|
||||
color:control.color
|
||||
FluFocusRectangle{
|
||||
visible: control.visualFocus
|
||||
|
@ -20,12 +20,7 @@ Item {
|
||||
return null
|
||||
return Window.window
|
||||
}
|
||||
property int borderless:{
|
||||
if(!FluTheme.isFrameless){
|
||||
return 0
|
||||
}
|
||||
return (window && (window.visibility === Window.Maximized)) ? 0 : 4
|
||||
}
|
||||
|
||||
property color color: {
|
||||
if(window && window.active){
|
||||
return FluTheme.isDark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(238/255,244/255,249/255,1)
|
||||
@ -35,32 +30,17 @@ Item {
|
||||
|
||||
id:root
|
||||
|
||||
|
||||
|
||||
FluWindowResize{
|
||||
border:borderless
|
||||
}
|
||||
|
||||
Behavior on opacity{
|
||||
NumberAnimation{
|
||||
duration: 100
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
property color borerlessColor : FluTheme.isDark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||
color: (window && window.active) ? borerlessColor : Qt.lighter(borerlessColor,1.1)
|
||||
border.width: 1
|
||||
anchors.fill: parent
|
||||
radius: 4
|
||||
border.color:FluTheme.isDark ? Qt.darker(FluTheme.primaryColor.lighter,1.3) : Qt.lighter(FluTheme.primaryColor.dark,1.2)
|
||||
}
|
||||
|
||||
Rectangle{
|
||||
id:container
|
||||
color:root.color
|
||||
anchors.fill: parent
|
||||
anchors.margins: borderless
|
||||
anchors.margins: (window && (window.visibility === Window.Maximized)) ? 8/Screen.devicePixelRatio : 0
|
||||
clip: true
|
||||
Behavior on color{
|
||||
ColorAnimation {
|
||||
@ -69,24 +49,13 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
updateWindowSize()
|
||||
Rectangle{
|
||||
border.width: 1
|
||||
anchors.fill: parent
|
||||
color: Qt.rgba(0,0,0,0,)
|
||||
border.color:FluTheme.isDark ? Qt.rgba(45/255,45/255,45/255,1) : Qt.rgba(226/255,230/255,234/255,1)
|
||||
}
|
||||
|
||||
Connections{
|
||||
target: FluTheme
|
||||
function onIsFramelessChanged(){
|
||||
updateWindowSize()
|
||||
}
|
||||
}
|
||||
|
||||
function updateWindowSize(){
|
||||
if(FluTheme.isFrameless){
|
||||
height = height + 34
|
||||
}else{
|
||||
height = height - 34
|
||||
}
|
||||
}
|
||||
|
||||
Connections{
|
||||
target: FluApp
|
||||
|
Reference in New Issue
Block a user