Skip to content

子窗口通过窗口内按钮打开和通过自定义TitleBar 中的菜单按钮打开弹出的窗口边框状态不一样 #153

Open
@q784702787

Description

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 中的菜单打开窗口会导致打开的子窗口没有边框

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions