<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[State change transition happens instantly instead of animating]]></title><description><![CDATA[<pre><code>import QtQuick 2.12
import QtQuick.Controls 1.4
import CustomQmlTypes 1.0

CustomWindow {
    id: mainWindow
    flags: Qt.ToolTip | Qt.WA_TranslucentBackground | Qt.FramelessWindowHint
    color: "#00000000"

    Loader {
        anchors.fill: parent
        id: login
        source: "Login.qml"
    }

    Loader {
        anchors.fill: parent
        id: dashboard
        source: "Dashboard.qml"
    }

    StateGroup {
        id: screenStates
        state: mainWindow.isLoggedIn() ? "dashScreen" : "loginScreen"
        states: [
            State {
                name: "loginScreen"
                PropertyChanges { target: login; opacity: 1; enabled: true }
                PropertyChanges { target: dashboard; opacity: 0; enabled: false }
            },
            State {
                name: "dashScreen"
                PropertyChanges { target: login; opacity: 0; enabled: false }
                PropertyChanges { target: dashboard; opacity: 1; enabled: true }
            }
        ]
        transitions: [
            Transition {
                from: "loginScreen"
                to: "dashScreen"
                ParallelAnimation {
                    OpacityAnimator { target: login; from: 1; to: 0; duration: 1000 }
                    OpacityAnimator { target: dashboard; from: 0; to: 1; duration: 1000 }
                }
            },
            Transition {
                from: "dashScreen"
                to: "loginScreen"
                ParallelAnimation {
                    OpacityAnimator { target: login; from: 0; to: 1; duration: 1000 }
                    OpacityAnimator { target: dashboard; from: 1; to: 0; duration: 1000 }
                }
            }
        ]
    }
}
</code></pre>
<p dir="auto">I have 2 screens and I'm trying to transition between them. When the state change happens, it's like transitions are ignored completely. In fact when I delete the lines related to transition, nothing changes. State change always happens instantly.</p>
<p dir="auto">Any ideas?</p>
]]></description><link>https://forum.qt.io/topic/99991/state-change-transition-happens-instantly-instead-of-animating</link><generator>RSS for Node</generator><lastBuildDate>Thu, 11 Jun 2026 18:57:47 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/99991.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 21 Feb 2019 22:18:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to State change transition happens instantly instead of animating on Fri, 22 Feb 2019 09:19:28 GMT]]></title><description><![CDATA[<p dir="auto">That works thanks. Though I found that I was doing something else wrong.<br />
For future reference I'm going to document it here.</p>
<p dir="auto">I have 2 states "loginScreen" and "dashScreen". I triggered the state change via a button</p>
<pre><code>onClicked: screenStates.state = "dashboard"
</code></pre>
<p dir="auto">As can be seen I've put the wrong state name. What bothers me is that QT doesn't complain about it. It just somehow switches the state to "dashScreen" and doesn't even tell you that you have the wrong state name.</p>
]]></description><link>https://forum.qt.io/post/513320</link><guid isPermaLink="true">https://forum.qt.io/post/513320</guid><dc:creator><![CDATA[tapirath]]></dc:creator><pubDate>Fri, 22 Feb 2019 09:19:28 GMT</pubDate></item><item><title><![CDATA[Reply to State change transition happens instantly instead of animating on Fri, 22 Feb 2019 08:55:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tapirath">@<bdi>tapirath</bdi></a> Try this, I was talking about changing the code to this.</p>
<pre><code>Transition {
                from: "loginScreen"
                to: "dashScreen"
                reversible: true

                    NumberAnimation { targets: [login, dashboard]; property: "opacity";/* from: 1; to: 0;*/ duration: 1000 }

            }
</code></pre>
]]></description><link>https://forum.qt.io/post/513311</link><guid isPermaLink="true">https://forum.qt.io/post/513311</guid><dc:creator><![CDATA[Yashpal]]></dc:creator><pubDate>Fri, 22 Feb 2019 08:55:41 GMT</pubDate></item><item><title><![CDATA[Reply to State change transition happens instantly instead of animating on Fri, 22 Feb 2019 07:56:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/yashpal">@<bdi>Yashpal</bdi></a> said in <a href="/post/513275">State change transition happens instantly instead of animating</a>:</p>
<blockquote>
<p dir="auto">NumberAnimation</p>
</blockquote>
<pre><code>        transitions: [
            Transition {
                reversible: true
                from: "loginScreen"
                to: "dashScreen"
                ParallelAnimation {
                    OpacityAnimator { target: login; from: 1; to: 0; duration: 1000 }
                    OpacityAnimator { target: dashboard; from: 0; to: 1; duration: 1000 }
                }
            }
        ]
</code></pre>
<p dir="auto">I've tried this. it didn't help.</p>
<p dir="auto">I didn't understand the solution about NumberAnimation. I need the change the opacity of 2 different targets that means I need 2 NumberAnimations no? How is that different?</p>
]]></description><link>https://forum.qt.io/post/513295</link><guid isPermaLink="true">https://forum.qt.io/post/513295</guid><dc:creator><![CDATA[tapirath]]></dc:creator><pubDate>Fri, 22 Feb 2019 07:56:24 GMT</pubDate></item><item><title><![CDATA[Reply to State change transition happens instantly instead of animating on Fri, 22 Feb 2019 06:56:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/tapirath">@<bdi>tapirath</bdi></a> Try replacing OpacityAnimator with NumberAnimation or use single transition with reversible set to true</p>
]]></description><link>https://forum.qt.io/post/513275</link><guid isPermaLink="true">https://forum.qt.io/post/513275</guid><dc:creator><![CDATA[Yashpal]]></dc:creator><pubDate>Fri, 22 Feb 2019 06:56:49 GMT</pubDate></item></channel></rss>