Hi,

I'm currently trying to find a way to make differents items on a ListModel
!  I design a general box, and I would like to add customs items on them. By
exemple, I would like to add a file manager on the first one, an addess book
on the second one, an agenda on the third ... But only on the green area.

The purpose is to find how we could make the green zone as free area, where
different developers will add her own widget. A easy way could be to
specifies on the listElement the name of a external existing qml file !

*main.qml*

> import QtQuick 1.0
>
> Item {
>   id: main
>   height: 300;
>   width: 800;
>   property int margin: 3;
>
>     Rectangle{
>       id: homeFrame
>       color: "black";
>         anchors.fill: parent;
>
>       ListModel{
>         id: list
>
>         ListElement{
>           name: "Box 1"
>             }
>         ListElement{
>           name: "Box 2"
>         }
>         ListElement{
>           name: "Box 3"
>         }
>         ListElement{
>           name: "Box 4"
>         }
>         ListElement{
>           name: "Box 5"
>         }
>         ListElement{
>           name: "Box 6"
>         }
>         ListElement{
>           name: "Box 7"
>         }
>         ListElement{
>           name: "Box 8"
>         }
>
>     } // End of ListModel
>
>     ListView{
>         id: flickable
>         property int w;
>         property int margin;
>         property int h_box;
>
>             anchors.fill: parent;
>         focus: true;
>         orientation: ListView.Horizontal
>         snapMode: ListView.SnapOneItem;
>         model: list
>         delegate: Box{}
>       }
>     }
> }
>


Box.qml

> import QtQuick 1.0
>
> Item{
>   property int w_screen: main.width;
>   property int margin: main.margin;
>
>   width: (w_screen -(4 * margin)) /3 ;
>   height: main.height;
>
>     Rectangle{
>     property int margin: parent.margin;
>     color: "green";
>     x: 14;
>     width: parent.width - 2 * parent.margin;
>     height: parent.height;
>
>         Rectangle{
>             width: parent.width;
>             height: 40;
>             color: "red";
>
>             Text{
>               text: name;
>               color: "white";
>               anchors.centerIn: parent;
>               horizontalAlignment: Qt.AlignHCenter;
>               font.weight: Font.Bold;
>             }
>        }
>   }
> }
>


-----------------------------------------------------
Thomas PABST
thomas.pa...@gmail.com
_______________________________________________
Qt-qml mailing list
Qt-qml@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-qml

Reply via email to