aboutsummaryrefslogtreecommitdiffstats
path: root/tests/testapplications/elements/content/GridViewElement.qml
blob: c2cea5962becd8c5b3da530d2599b0df4f0a49da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: http://www.qt-project.org/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

import QtQuick 2.0

Rectangle {
    id: gridviewelement; radius: 5; clip: true
    property int cellsize
    cellsize: Math.floor(elementview.width / 3)

    GridView {
        id: elementview
        height: parent.height * .98; width: parent.width * .98
        anchors.centerIn: parent
        delegate: griddelegate; model: elements; visible: { qmlfiletoload == "" }
        highlightFollowsCurrentItem: true; highlightRangeMode: ListView.StrictlyEnforceRange
        cellWidth: cellsize; cellHeight: cellsize
    }

    // Delegates for the launcher grid
    Component {
        id: griddelegate
        Item {
            height: cellsize; width: cellsize
            Column { anchors.fill: parent; spacing: 2
                Rectangle {
                    height: parent.height * .8; width: height
                    color: "lightgray"; radius: 5; smooth: true
                    anchors.horizontalCenter: parent.horizontalCenter
                    Image {
                        height: parent.height*.75; width: height
                        anchors.centerIn: parent
                        source: "pics/logo.png"; fillMode: Image.PreserveAspectFit
                    }
                }
                Text {
                    height: parent.height * .8; width: parent.width
                    anchors.horizontalCenter: parent.horizontalCenter; text: model.label; elide: Text.ElideRight
                    horizontalAlignment: Text.AlignHCenter
                }
            }
            MouseArea {
                anchors.fill: parent
                hoverEnabled: true // For desktop testing
                onClicked: { runapp(model.label+"Element.qml"); }
                onEntered: { helptext = model.help }
                onExited: { helptext = "" }
            }
        }
    }

    // Elements list
    ListModel {
        id: elements
        ListElement { label: "Rectangle"; help: "The Rectangle item provides a filled rectangle with an optional border." }
        ListElement { label: "Image"; help: "The Image element displays an image in a declarative user interface" }
        ListElement { label: "AnimatedImage"; help: "An image element that supports animations" }
        ListElement { label: "BorderImage"; help: "The BorderImage element provides an image that can be used as a border." }
        ListElement { label: "SystemPalette"; help: "The SystemPalette element provides access to the Qt palettes." }
        ListElement { label: "Text"; help: "The Text item allows you to add formatted text to a scene." }
        ListElement { label: "FontLoader"; help: "The FontLoader element allows fonts to be loaded by name or URL." }
        ListElement { label: "TextInput"; help: "The TextInput item displays an editable line of text." }
        ListElement { label: "TextEdit"; help: "The TextEdit item displays multiple lines of editable formatted text." }
        ListElement { label: "ListView"; help: "The ListView item provides a list view of items provided by a model." }
        ListElement { label: "Flipable"; help: "The Flipable item provides a surface that can be flipped" }
        ListElement { label: "Column"; help: "The Column item arranges its children vertically." }
        ListElement { label: "Row"; help: "The Row item arranges its children horizontally." }
        ListElement { label: "Grid"; help: "The Grid item positions its children in a grid." }
        ListElement { label: "Flow"; help: "The Flow item arranges its children side by side, wrapping as necessary." }
        ListElement { label: "Repeater"; help: "The Repeater element allows you to repeat an Item-based component using a model." }
        ListElement { label: "IntValidator"; help: "This element provides a validator for integer values." }
        ListElement { label: "DoubleValidator"; help: "This element provides a validator for non-integer values." }
        ListElement { label: "RegExpValidator"; help: "This element provides a validator, which counts as valid any string which matches a specified regular expression." }
        ListElement { label: "Flickable"; help: "The Flickable item provides a surface that can be \"flicked\"." }
        ListElement { label: "Keys"; help: "The Keys attached property provides key handling to Items." }
        ListElement { label: "MouseArea"; help: "The MouseArea item enables simple mouse handling." }
        ListElement { label: "SequentialAnimation"; help: "The SequentialAnimation element allows animations to be run sequentially." }
        ListElement { label: "ParallelAnimation"; help: "The ParallelAnimation element allows animations to be run in parallel." }
        ListElement { label: "XmlListModel"; help: "The XmlListModel element is used to specify a read-only model using XPath expressions." }
        ListElement { label: "Scale"; help: "The Scale element provides a way to scale an Item." }
        ListElement { label: "ParticleSystem"; help: "The ParticleSystem brings together ParticlePainter, Emitter and Affector elements." }
        ListElement { label: "ImageParticle"; help: "The ImageParticle element visualizes logical particles using an image." }
        ListElement { label: "Emitter"; help: "The Emitter element allows you to emit logical particles." }
        ListElement { label: "Affector"; help: "Affector elements can alter the attributes of logical particles at any point in their lifetime." }
        ListElement { label: "Shape"; help: "The Shape element allows you to specify an area for affectors and emitter." }
        ListElement { label: "TrailEmitter"; help: "The TrailEmitter element allows you to emit logical particles from other logical particles." }
        ListElement { label: "Direction"; help: "The Direction elements allow you to specify a vector space." }
        ListElement { label: "SpriteImage"; help: "The SpriteImage element plays stochastic sprite animations." }
    }
}