Compare commits

..

3 Commits

Author SHA1 Message Date
zhuzichu 8662eb97aa update 2023-11-27 16:45:37 +08:00
zhuzichu 55a77eba4b Merge branch 'main' of https://github.com/zhuzichu520/FluentUI 2023-11-27 15:30:35 +08:00
zhuzichu 5dd3320f66 fix bug #356 2023-11-27 15:29:54 +08:00
6 changed files with 95 additions and 16 deletions

View File

@ -88,6 +88,20 @@ FluScrollablePage{
} }
} }
FluArea{
Layout.fillWidth: true
Layout.topMargin: 20
height: 50
paddings: 10
FluCheckBox{
text:"fitsAppBarWindows"
checked: window.fitsAppBarWindows
anchors.verticalCenter: parent.verticalCenter
onClicked: {
window.fitsAppBarWindows = !window.fitsAppBarWindows
}
}
}
FluArea{ FluArea{
Layout.fillWidth: true Layout.fillWidth: true
@ -215,5 +229,4 @@ FluScrollablePage{
} }
} }
} }
} }

View File

@ -41,8 +41,11 @@ FluWindow {
} }
} }
Component.onCompleted: { onFirstVisible: {
tour.open() tour.open()
}
Component.onCompleted: {
checkUpdate(true) checkUpdate(true)
FluEventBus.registerEvent(event_checkupdate) FluEventBus.registerEvent(event_checkupdate)
} }
@ -239,7 +242,7 @@ FluWindow {
} }
function handleDarkChanged(button){ function handleDarkChanged(button){
if(!FluTheme.enableAnimation){ if(!FluTheme.enableAnimation || window.fitsAppBarWindows === false){
changeDark() changeDark()
}else{ }else{
loader_reveal.sourceComponent = com_reveal loader_reveal.sourceComponent = com_reveal

View File

@ -91,6 +91,21 @@ FluScrollablePage{
} }
} }
FluArea{
Layout.fillWidth: true
Layout.topMargin: 20
height: 50
paddings: 10
FluCheckBox{
text:"fitsAppBarWindows"
checked: window.fitsAppBarWindows
anchors.verticalCenter: parent.verticalCenter
onClicked: {
window.fitsAppBarWindows = !window.fitsAppBarWindows
}
}
}
FluArea{ FluArea{
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 20 Layout.topMargin: 20
@ -217,5 +232,4 @@ FluScrollablePage{
} }
} }
} }
} }

View File

@ -44,8 +44,11 @@ FluWindow {
} }
} }
Component.onCompleted: { onFirstVisible: {
tour.open() tour.open()
}
Component.onCompleted: {
checkUpdate(true) checkUpdate(true)
FluEventBus.registerEvent(event_checkupdate) FluEventBus.registerEvent(event_checkupdate)
} }
@ -242,7 +245,7 @@ FluWindow {
} }
function handleDarkChanged(button){ function handleDarkChanged(button){
if(!FluTheme.enableAnimation){ if(!FluTheme.enableAnimation || window.fitsAppBarWindows === false){
changeDark() changeDark()
}else{ }else{
loader_reveal.sourceComponent = com_reveal loader_reveal.sourceComponent = com_reveal

View File

@ -39,6 +39,7 @@ Window {
property bool showMaximize: true property bool showMaximize: true
property bool showStayTop: true property bool showStayTop: true
property bool useSystemAppBar property bool useSystemAppBar
property bool autoMaximize: false
property var closeListener: function(event){ property var closeListener: function(event){
if(closeDestory){ if(closeDestory){
destoryOnClose() destoryOnClose()
@ -48,6 +49,7 @@ Window {
} }
} }
signal initArgument(var argument) signal initArgument(var argument)
signal firstVisible()
id:window id:window
maximumWidth: useSystemAppBar&&fixSize ? width : 16777215 maximumWidth: useSystemAppBar&&fixSize ? width : 16777215
maximumHeight: useSystemAppBar&&fixSize ? height : 16777215 maximumHeight: useSystemAppBar&&fixSize ? height : 16777215
@ -64,17 +66,26 @@ Window {
d.changedStayTop() d.changedStayTop()
if(useSystemAppBar){ if(useSystemAppBar){
window.moveWindowToDesktopCenter() window.moveWindowToDesktopCenter()
window.visible = true if(window.autoMaximize){
window.showMaximized()
}else{
window.show()
}
} }
} }
Component.onDestruction: { Component.onDestruction: {
lifecycle.onDestruction() lifecycle.onDestruction()
} }
onVisibleChanged: { onVisibleChanged: {
if(visible && d.isFirstVisible){
window.firstVisible()
d.isFirstVisible = false
}
lifecycle.onVisible(visible) lifecycle.onVisible(visible)
} }
QtObject{ QtObject{
id:d id:d
property bool isFirstVisible: true
function changedStayTop(){ function changedStayTop(){
function toggleStayTop(){ function toggleStayTop(){
if(window.stayTop){ if(window.stayTop){
@ -113,13 +124,18 @@ Window {
left: parent.left left: parent.left
right: parent.right right: parent.right
} }
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar sourceComponent: FluApp.useSystemAppBar ? undefined : com_app_bar
} }
Component{ Component{
id:com_app_bar id:com_app_bar
Item{ Item{
data: window.appBar data: window.appBar
height: window.fitsAppBarWindows ? 0 : childrenRect.height height: {
if(FluApp.useSystemAppBar){
return 0
}
return window.fitsAppBarWindows ? 0 : childrenRect.height
}
} }
} }
Item{ Item{
@ -224,9 +240,13 @@ Window {
if (blurBehindWindowEnabled) if (blurBehindWindowEnabled)
window.background = undefined window.background = undefined
} }
if(window.autoMaximize){
window.showMaximized()
}else{
window.show() window.show()
} }
} }
}
WindowLifecycle{ WindowLifecycle{
id:lifecycle id:lifecycle
} }
@ -234,7 +254,7 @@ Window {
id:loader_window_border id:loader_window_border
anchors.fill: parent anchors.fill: parent
z:999 z:999
sourceComponent: window.useSystemAppBar ? undefined : com_window_border sourceComponent: FluApp.useSystemAppBar ? undefined : com_window_border
} }
Component{ Component{
id:com_window_border id:com_window_border
@ -292,4 +312,7 @@ Window {
_pageRegister.onResult(data) _pageRegister.onResult(data)
} }
} }
function containerItem(){
return container
}
} }

View File

@ -38,6 +38,7 @@ Window {
property bool showMaximize: true property bool showMaximize: true
property bool showStayTop: true property bool showStayTop: true
property bool useSystemAppBar property bool useSystemAppBar
property bool autoMaximize: false
property var closeListener: function(event){ property var closeListener: function(event){
if(closeDestory){ if(closeDestory){
destoryOnClose() destoryOnClose()
@ -47,6 +48,7 @@ Window {
} }
} }
signal initArgument(var argument) signal initArgument(var argument)
signal firstVisible()
id:window id:window
maximumWidth: useSystemAppBar&&fixSize ? width : 16777215 maximumWidth: useSystemAppBar&&fixSize ? width : 16777215
maximumHeight: useSystemAppBar&&fixSize ? height : 16777215 maximumHeight: useSystemAppBar&&fixSize ? height : 16777215
@ -63,17 +65,26 @@ Window {
d.changedStayTop() d.changedStayTop()
if(useSystemAppBar){ if(useSystemAppBar){
window.moveWindowToDesktopCenter() window.moveWindowToDesktopCenter()
window.visible = true if(window.autoMaximize){
window.showMaximized()
}else{
window.show()
}
} }
} }
Component.onDestruction: { Component.onDestruction: {
lifecycle.onDestruction() lifecycle.onDestruction()
} }
onVisibleChanged: { onVisibleChanged: {
if(visible && d.isFirstVisible){
window.firstVisible()
d.isFirstVisible = false
}
lifecycle.onVisible(visible) lifecycle.onVisible(visible)
} }
QtObject{ QtObject{
id:d id:d
property bool isFirstVisible: true
function changedStayTop(){ function changedStayTop(){
function toggleStayTop(){ function toggleStayTop(){
if(window.stayTop){ if(window.stayTop){
@ -112,13 +123,18 @@ Window {
left: parent.left left: parent.left
right: parent.right right: parent.right
} }
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar sourceComponent: FluApp.useSystemAppBar ? undefined : com_app_bar
} }
Component{ Component{
id:com_app_bar id:com_app_bar
Item{ Item{
data: window.appBar data: window.appBar
height: window.fitsAppBarWindows ? 0 : childrenRect.height height: {
if(FluApp.useSystemAppBar){
return 0
}
return window.fitsAppBarWindows ? 0 : childrenRect.height
}
} }
} }
Item{ Item{
@ -223,9 +239,13 @@ Window {
if (blurBehindWindowEnabled) if (blurBehindWindowEnabled)
window.background = undefined window.background = undefined
} }
if(window.autoMaximize){
window.showMaximized()
}else{
window.show() window.show()
} }
} }
}
WindowLifecycle{ WindowLifecycle{
id:lifecycle id:lifecycle
} }
@ -233,7 +253,7 @@ Window {
id:loader_window_border id:loader_window_border
anchors.fill: parent anchors.fill: parent
z:999 z:999
sourceComponent: window.useSystemAppBar ? undefined : com_window_border sourceComponent: FluApp.useSystemAppBar ? undefined : com_window_border
} }
Component{ Component{
id:com_window_border id:com_window_border
@ -291,4 +311,7 @@ Window {
_pageRegister.onResult(data) _pageRegister.onResult(data)
} }
} }
function containerItem(){
return container
}
} }