How to display the assigned property component in QML?



  • In Main.qml

    Item {
        id:windowId
        width:200;height:200;
        Page{
          style: MyStyle{
               id:myStyleId
               background: Rectangle{
                    width:30;height;30;color:"blue"
               }               
          }
        }
    }
    

    In Page.qml

    Item {
        id: pageId
        property MyStyle style
        //How to display the style property
    }
    

    In MyStyle.qml

    Item {
        id: mystyleId
        property Rectangle background
        //How to display the background property
     }
    

    How do I display the style property inside Page and background property insode MyStyle.

    I have tried doing like this in Page.qml and also similarly in MyStyle.qml, but still it is not displaying without any errors

    Item {
        property alias style : loader.sourceComponent
    
        Loader { id: loader }
    }
    


  • What do you mean by display ?



  • @imran20487
    error..
    height;200;
    It should be width:200;height:200; in main.qml at two places.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.