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

Catching qml Dialog closing by window decoration Close button



  • Is there a way to catch (or prevent) the user closing a QML Dialog window by pressing the window decoration X (Close) button in desktop environment?

    Having the X-button in the titlebar AND not being able to handle the closing event would be a bug IMO, because user can then bypass the normal button handling and an application may not be able to continue as expected. Handling the documented signals from Dialog doesn't seem to work.



  • Could Window.window.onClosing be a solution? But when I try to use it, I get an error:
    QQmlApplicationEnginePrivate::_q_finishLoad 132: qrc:/main.qml:207 ".onClosing" is not available due to component versioning.

    Edit: Qt 5.7.0


Log in to reply