Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Looking for a specific QML Type



  • Are there any premade QML Types that have a label and content functionality? For instance:

    label: "This label"
    content: --some QM object or Type
    

    does that make sense? For instance, lets say my "content" for this Type was a simple Text{text: "hello world"} then it would something like this overall:

    This Label
    hello world

    and if it were a Repeater{model:3; Text{text: "hello world:}} then it would look something like this:

    This Label
    hello world
    hello world
    hello world



  • hi @RobM
    you can create a reusable component like this

    Item {
        property alias childItem : loader.sourceComponent
        Text { id:title;text: "This label" }
        Loader { id: loader;anchors.top: title.bottom }
    }
    
    MyComponent{
           childItem: Column{
               Repeater{
                   model : 3
                   Text {
                       id: name
                       text: "hello world"
                   }
               }
           }
       }
    


  • hi @RobM
    you can create a reusable component like this

    Item {
        property alias childItem : loader.sourceComponent
        Text { id:title;text: "This label" }
        Loader { id: loader;anchors.top: title.bottom }
    }
    
    MyComponent{
           childItem: Column{
               Repeater{
                   model : 3
                   Text {
                       id: name
                       text: "hello world"
                   }
               }
           }
       }
    


  • @LeLev said in Looking for a specific QML Type:

    Item {
    property alias childItem : loader.sourceComponent
    Text { id:title;text: "This label" }
    Loader { id: loader;anchors.top: title.bottom }
    }

    Probably want this too:

    property alias title: title.text
    

Log in to reply