qwindowkit
qwindowkit copied to clipboard
子窗口通过窗口内按钮打开和通过自定义TitleBar 中的菜单按钮打开弹出的窗口边框状态不一样
Window{
id:mainWindow
color: "#ffffff"
width : 1000
height : 800
visible : true
Component.onCompleted: {
windowAgent.setup(mainWindow)
mainWindow.visible = true
}
WindowAgent {
id: windowAgent
}
ColumnLayout{
anchors.fill: parent
CustomTitleBar{
id:titleBar
Layout.preferredHeight: 48
Layout.fillWidth: true
title:mainWindow.title
mainWindow: mainWindow
windowAgent: windowAgent
onMenuButtonClicked: {
appMenu.open()
}
}
Button{
id:button
text:"button"
Layout.fillHeight: true
onClicked: {
child.show()
}
}
}
Window{
id:child
width: 300
height: 400
title: qsTr("About")
modality: Qt.ApplicationModal;
// visible: true
Column{
anchors.fill: parent
Text {
id: appName
anchors.horizontalCenter: parent.horizontalCenter
text: "App 123"
font{
family:"Arial"
bold:true
pixelSize: 15
}
}
}
}
AppMenu{
id:appMenu
onMenuAction:{
child.show()
}
}
}
上面的程序有两个按钮可以打开child 窗口 通过主窗口内的button 窗口打开child 窗口此时窗口边框显示正常是系统默认的边框 通过自定义TitleBar 中的菜单打开窗口会导致打开的子窗口没有边框
测试发现只要启用了QWK自定义边框代理,然后通过Menu 中按钮呼出的窗口也会被隐藏系统边框,不管Menu是在哪里打开的