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. How to display the assigned property component in QML?
Forum Updated to NodeBB v4.3 + New Features

How to display the assigned property component in QML?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 757 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.
  • I Offline
    I Offline
    imran20487
    wrote on last edited by imran20487
    #1

    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 }
    }
    
    T 1 Reply Last reply
    0
    • ibiaI Offline
      ibiaI Offline
      ibia
      wrote on last edited by
      #2

      What do you mean by display ?

      1 Reply Last reply
      0
      • I imran20487

        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 }
        }
        
        T Offline
        T Offline
        Tirupathi Korla
        wrote on last edited by Tirupathi Korla
        #3

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

        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