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. Insert un placeholder or similar in a state
Forum Updated to NodeBB v4.3 + New Features

Insert un placeholder or similar in a state

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 256 Views 1 Watching
  • 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.
  • PollyP Offline
    PollyP Offline
    Polly
    wrote on last edited by
    #1

    Hi, maybe this topic has already been adressed.
    I have an item that i want to reuse more times. Inside there's a Loader and some States. I want to change property loader.source every time, for example i use that item three times and an item call a video, another a picture, and last a webpage. There's possible to use a placeholder or similar to obtain that target?

    
    callObject.qml
    ...
    Item{
    ....
         Loader{
          id:loader1
    ...}
    states[
              State {
                        id:state1
                  PropertyChanges { target: loader1;source: SOME PLACEHOLDER; }
    
    
    main.qml
    ...
    callObject{
      id:call1
    SOMEPLACEHOLDER:"video.qml"
    }
    
    callObject{
     id:call2
    SOMEPLACEHOLDER:"webpage.qml"
    }
    
    callObject{
     id:call3
    SOMEPLACEHOLDER:"image.qml"
    }
    
    ODБOïO 1 Reply Last reply
    0
    • PollyP Polly

      Hi, maybe this topic has already been adressed.
      I have an item that i want to reuse more times. Inside there's a Loader and some States. I want to change property loader.source every time, for example i use that item three times and an item call a video, another a picture, and last a webpage. There's possible to use a placeholder or similar to obtain that target?

      
      callObject.qml
      ...
      Item{
      ....
           Loader{
            id:loader1
      ...}
      states[
                State {
                          id:state1
                    PropertyChanges { target: loader1;source: SOME PLACEHOLDER; }
      
      
      main.qml
      ...
      callObject{
        id:call1
      SOMEPLACEHOLDER:"video.qml"
      }
      
      callObject{
       id:call2
      SOMEPLACEHOLDER:"webpage.qml"
      }
      
      callObject{
       id:call3
      SOMEPLACEHOLDER:"image.qml"
      }
      
      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      @Polly hi
      You can simply add a property into CallObject.qml

      //CallObject.qml
      Item {
          property url page : ""
      
      //main.qml
      CallObject{
              page: Qt.resolvedUrl("Page1.qml")
      }
      
      PollyP 1 Reply Last reply
      0
      • ODБOïO ODБOï

        @Polly hi
        You can simply add a property into CallObject.qml

        //CallObject.qml
        Item {
            property url page : ""
        
        //main.qml
        CallObject{
                page: Qt.resolvedUrl("Page1.qml")
        }
        
        PollyP Offline
        PollyP Offline
        Polly
        wrote on last edited by
        #3

        @LeLev thank you
        i'll try.

        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