Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Rectangle covering Page header?



  • Hi,

    I'm making a custom modal dialog widget. The normal Dialog won't work because we don't want the title-bar and we want more control over the look and feel. My screen is a Page with a header, some content, and then a Rectangle that is visible: false, color: "#85000000", z: 80, anchors.fill: parent, and mouse area to trap clicks. The modal behavior is working but I can't get the rectangle to cover the Page's header. Is there a way to get a Rectangle to cover the Page's header?

    Thanks,
    -chris



  • Post your code :)



  • @christofer That is because the Rectangle is parented to the content area.

    either you can create your own custom Popup instead of the Rectangle

    or

    set the Rectangle's parent as parent: Overlay.overlay

    Ref: Overlay

    Overlay provides a layer for popups, ensuring that popups are displayed above other content and that the background is dimmed when a modal or dimmed popup is visible.
    
    The overlay is an ordinary Item that covers the entire window. It can be used as a visual parent to position a popup in scene coordinates.
    


  • @Mammamia Thank you! This is exactly what I was missing.


Log in to reply