I have a button that needs to show or hide a window. At the same time, when the window is displayed, clicking anywhere outside the window needs to hide the window. How can I achieve this in qml?
I used the activefocusitemchanged signal and closed the window in the signal, but at this time if I click the button, it will trigger the opening again, which should have been closed.
Not only does the closing strategy require the mouse to click outside to disappear, but also a button to control closing and showing. Clicking on the button triggers the closing strategy at the same time, which will cause the window to close and then open again.