I found a partial workaround which makes qml file coding easier. Idea is to copy&paste the code of components and they will get indexes by themself:

import QtQuick 2.0
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
import Machinekit.HalRemote 1.0
import Machinekit.HalRemote.Controls 1.0
import Machinekit.Application 1.0
import Machinekit.Service 1.0
import Machinekit.Application.Controls 1.0

ServiceWindow {
    id: main
    title: qsTr("appname")
    property bool completed: false
    Component.onCompleted: {
        completed = true
    }

    function itemIndex(item) {
        if (item.parent == null)
            return -1
        var siblings = item.parent.children
        for (var i = 0; i < siblings.length; i++)
            if (siblings[i] == item)
                return i
        return -1 //will never happen
    }

    Service {
        id: halrcompService
        type: "halrcomp"
        required: true
    }

    Service {
        id: halrcmdService
        type: "halrcmd"
        required: true
    }

    HalRemoteComponent {
        id: remoteComponent
        name: "ui_test"
        halrcmdUri: halrcmdService.uri
        halrcompUri: halrcompService.uri
ready: (halrcompService.ready && halrcmdService.ready) || remoteComponent.connected
//        containerItem: parent
        containerItem: container
    }

    ColumnLayout {
        id: container
        property int index: 0
        Layout.fillWidth: true
        Layout.fillHeight: true
// The code describing each of the items below is identical - just copy and paste them as many times as you need

        HalButton {
            property int i: itemIndex(this)
            name: "pin" + i
            text: "Button" + i
//            halPin.direction: HalPin.IO
//            halPin.type: HalPin.Float
//            halPin.value: {checked ? 1:0}
            checkable: true
        }
        HalButton {
            property int i: itemIndex(this)
            name: "pin" + i
            text: "Button" + i
//            halPin.direction: HalPin.IO
//            halPin.type: HalPin.Float
//            halPin.value: {checked ? 1:0}
            checkable: true
        }
        HalButton {
            property int i: itemIndex(this)
            name: "pin" + i
            text: "Button" + i
//            halPin.direction: HalPin.IO
//            halPin.type: HalPin.Float
//            halPin.value: {checked ? 1:0}
            checkable: true
        }

// The code describing each of the items above is identical - just copy and paste them as many times as you need
    }
}




--
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- You received this message because you are subscribed to the Google Groups "Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to