Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. What is incorrect about this Loader and it's states?
Forum Updated to NodeBB v4.3 + New Features

What is incorrect about this Loader and it's states?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 136 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    EStudley
    wrote on last edited by EStudley
    #1

    I am creating a simple Loader element with three states. I want to set a default state for the Loader.

    Loader {
        id: loader
        Layout.fillWidth: true
        Layout.fillHeight: true
    
        states: [
            State {
                name: "Page1"
                PropertyChanges { target: loader; source: "Page1.qml" }
            },
            State {
                name: "Page2"
                PropertyChanges { target: loader; source: "Page2.qml" }
            },
            State {
                name: "Page3"
                PropertyChanges { target: loader; source: "Page3.qml" }
            }
        ]
    }
    

    If I try to set a default state with states:

    state: "Page1"
    

    Page1.qml is rendered twice, one incorrectly at 0,0 of the Loader that never disappears and one correctly that switches when the state is changed later. It's like the width of the first version is 0..

    If I set it after Component completion:

    Component.onCompleted: state = "Page1"
    

    The default page loads once as expected and switches when the state is changed later.

    Any ideas?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved