It's not a bug.
GridLayout is not a Positioner, so it does not provide such functionality 
(however, it could). In this specific case you might be able to use the index 
from the Repeater in your case.

If that's not sufficient, feel free to file a suggestion at 
bugreports.qt-project.org.
Jan Arve

From: [email protected] 
[mailto:[email protected]] On 
Behalf Of [email protected]
Sent: 28. juli 2013 15:06
To: [email protected]
Subject: [Development] [QML] Positioner and Qt Quick Layout

Hi,
When testing Qt Quick Layout, I see it's not possible to get index from 
Positioner in layouts.
This code works:


import QtQuick 2.0



Grid {

    rows: 3; columns: 3

    spacing: 4

    Repeater {

        model: 9

        Rectangle {

            width: 50; height: 50

            color: "lightgreen"

            Text {

                anchors.centerIn: parent

                font.pointSize: 14

                text: parent.Positioner.index

            }

        }

    }

}



But not this code:



import QtQuick 2.0

import QtQuick.Layouts 1.0



GridLayout {

    rows: 3; columns: 3

    Repeater {

        model: 9

        Rectangle {

            width: 50; height: 50

            color: "lightgreen"

            Text {

                anchors.centerIn: parent

                font.pointSize: 14

                text: parent.Positioner.index

            }

        }

    }

}



Bug ou feature ? (I did not find any entry in bugreport)

Thanks

Guillaume Belz
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to