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. Assign QML component to inner QML component. How?
Forum Updated to NodeBB v4.3 + New Features

Assign QML component to inner QML component. How?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
4 Posts 3 Posters 420 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.
  • B Offline
    B Offline
    bogong
    wrote on last edited by
    #1

    Hello!
    I have the custom QML component that have few inner components CustomComponent.qml:

    // System includes
    import QtQuick 2.15
    import QtQuick.Controls 2.15
    
    // Component
    Rectangle {
    
    	id: oWrapper;
    	width: x;
    	height: y;
    	
    	Rectangle {
    
    		id: oContent;
    		color: "red";
    		width: parent.width;
    		height: parent.height;
    	}
    }
    

    The question is how do add another one QML component when to inner Rectangle when I am using CustomComponent.qml?

    CustomComponent {
    
    	Rectangle {
    
    		id: oObject1;
    		color: "blue";
    		width: 10;
    		height: 10;
    	}
    }
    

    In this example the QML component oObject need to be added to oContent but not oWrapper.

    ODБOïO 1 Reply Last reply
    0
    • B bogong

      Hello!
      I have the custom QML component that have few inner components CustomComponent.qml:

      // System includes
      import QtQuick 2.15
      import QtQuick.Controls 2.15
      
      // Component
      Rectangle {
      
      	id: oWrapper;
      	width: x;
      	height: y;
      	
      	Rectangle {
      
      		id: oContent;
      		color: "red";
      		width: parent.width;
      		height: parent.height;
      	}
      }
      

      The question is how do add another one QML component when to inner Rectangle when I am using CustomComponent.qml?

      CustomComponent {
      
      	Rectangle {
      
      		id: oObject1;
      		color: "blue";
      		width: 10;
      		height: 10;
      	}
      }
      

      In this example the QML component oObject need to be added to oContent but not oWrapper.

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      https://stackoverflow.com/questions/5021350/how-do-you-assign-a-qml-item-to-a-component-property-in-qml-and-then-use-that-ob

      GrecKoG 1 Reply Last reply
      2
      • ODБOïO ODБOï

        https://stackoverflow.com/questions/5021350/how-do-you-assign-a-qml-item-to-a-component-property-in-qml-and-then-use-that-ob

        GrecKoG Offline
        GrecKoG Offline
        GrecKo
        Qt Champions 2018
        wrote on last edited by
        #3

        @LeLev said in Assign QML component to inner QML component. How?:

        https://stackoverflow.com/questions/5021350/how-do-you-assign-a-qml-item-to-a-component-property-in-qml-and-then-use-that-ob

        Use the highest voted answer, not the accepted one with the Loader.

        1 Reply Last reply
        1
        • B Offline
          B Offline
          bogong
          wrote on last edited by
          #4

          Thx to all. Issue closed. Solution found. Example published https://github.com/ArboreusSystems/arboreus_examples/tree/master/qt/QML/CustomComponent/CustomComponent_v1

          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