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

The Qml taskbar is restored to the display state



  • Dear Qt development team and forum friends, hello. I am writing a program using Qml, and the problem I have encountered is that the program is minimized when a button is clicked. Then after minimizing, clicking the program icon in the taskbar will restore to the display state, how can I judge it is this time? Because I want to add an animation to this process. I wrote this in the Widget development method:

    if(event->type() == QEvent::WindowStateChange)
    {
    QWindowStateChangeEvent* stateEvent = static_cast<QWindowStateChangeEvent*>(event);

             if(stateEvent->oldState() & Qt::WindowMinimized)
             {
                // TODO: Animation
                 return true;
             }
    
         }
    

    Is there oldState in Qml?
    I wrote it like this in Qml
    onWindowStateChanged:
    {

         if (windowState === Qt.WindowMinimized)
         {
             console.log("normal")
         }
     }
    

    Obviously, the previous state should be used for judgment, so what does oldState correspond to in Qml?


Log in to reply