Qt6 topics merged with General

Best way to have a button stay on top at all times

  • Hello,

    I have a button that needs to be on the top of the UI at all times and if clicked take the click event before anyone else. So even if there is a popup, and I click on the button, I don't want the popup to be closed, instead I want this button to take the mouse event. However I don't want to change modal for the popup since I do want the popup to close if user clicks anywhere outside of the popup, except for this one button. How would you say is the easiest / cleanest way to achieve this?

    Thank you

  • Hi @Puya

    You can try to set the button z-property to a large value (e.g. 1000) if elements belongs to the same item: https://doc.qt.io/qt-6/qml-qtquick-item.html#z-prop

  • @ndias I don't think z value can help when it comes to Popup.

Log in to reply