[Interest] QML id

Jesus Fernandez jesus.fernandez at theqtcompany.com
Mon Apr 11 11:59:08 CEST 2016


Hi!

You can store the items in a custom JavaScript variable:

import QtQuick 2.5
import QtQuick.Window 2.2

Window {
    property var rowItems
    visible: true

    Component.onCompleted: {
        /rowItems/ = [];

        for (var /i/ = 0; /i/ < 64; ++/i/) {
            /rowItems/[/i/] = /Qt/.createQmlObject(
                        'import QtQuick 2.0; Rectangle {color: "red"; width: 20; height: 20}',
                        /column/);
        }

        /rowItems/[10].color = "green";
    }

    Column {
        id: /column/;
    }
}



On Monday, April 11, 2016 12:49:11 PM Igor Mironchik wrote:
> Look. I want to generate chess board - rectangles (8x8). And I want to
> place numbers an letters on the sides. This numbers and letters should
> be anchored to centers of rectangles. I.e. I want to have something like:
> 
> Text {
>      anchor.horizontalCenter: cell00.horizontalCenter
> }
> 
> ...
> 
> On 11.04.2016 12:40, Gian Maxera wrote:
> > Hello,
> > I don’t think so.
> > Why do you need it ? Maybe we can suggest to you an alternative solution.
> > 
> > Ciao,
> > Gianluca.
> > 
> >> On 11 Apr 2016, at 10:38, Igor Mironchik <igor.mironchik at gmail.com>
> >> wrote:
> >> 
> >> Hello,
> >> 
> >> Is it possible to generate id of item in Repeater, for example?
> >> 
> >> Thank you.
> >> _______________________________________________
> >> Interest mailing list
> >> Interest at qt-project.org
> >> http://lists.qt-project.org/mailman/listinfo/interest
> 
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest

-- 

Best regards,
Jesus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160411/08913132/attachment.html>


More information about the Interest mailing list