- 
    Bug 
- 
    Resolution: Done
- 
    P2: Important 
- 
    5.15
- 
    None
- 
        0d3b8f832aad04c255dac64588b2693f2119cc0c (qt/qtquickcontrols2/dev)
https://doc.qt.io/qt-5/qml-qtquick-controls2-dialog.html#accept-method says:
Closes the dialog and emits the accepted() signal.
When running this code
import QtQuick 2.12 import QtQuick.Controls 2.12 ApplicationWindow { width: 400 height: 400 visible: true Dialog { standardButtons: Dialog.Ok | Dialog.Cancel visible: true onAccepted: print("accepted") onClosed: print("closed") } }
with the Material style (which has transitions for Dialog), the output is:
qml: accepted qml: closed
When run with the Default style (which has no transitions for Dialog), the output is:
qml: closed qml: accepted
Besides contradicting the documentation, the concrete problem with this is that it breaks code like this:
    onAccepted: project.modifyAnimation(animationIndex) // oops, animationIndex is -1
    onClosed: {
        animationIndex = -1
        animation = null
        acceptOnNextModify = false
    }
This worked in my application (which uses the Material style) but failed in my tests, where I use the Default style to speed things up.
I think we should fix this by changing the behaviour, and always emit accepted (and rejected) before closed, since they are emitted synchronously.