2022-05-13 13:12:05 +00:00
|
|
|
// Copyright (C) 2017 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2022-08-31 07:59:05 +00:00
|
|
|
import QtQuick
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
Rectangle {
|
2023-06-28 13:30:40 +00:00
|
|
|
width: 300
|
|
|
|
height: 400
|
2011-04-27 10:05:43 +00:00
|
|
|
color: "white"
|
|
|
|
|
|
|
|
ListModel {
|
|
|
|
id: appModel
|
|
|
|
ListElement { name: "Music"; icon: "pics/AudioPlayer_48.png" }
|
|
|
|
ListElement { name: "Movies"; icon: "pics/VideoPlayer_48.png" }
|
|
|
|
ListElement { name: "Camera"; icon: "pics/Camera_48.png" }
|
|
|
|
ListElement { name: "Calendar"; icon: "pics/DateBook_48.png" }
|
|
|
|
ListElement { name: "Messaging"; icon: "pics/EMail_48.png" }
|
|
|
|
ListElement { name: "Todo List"; icon: "pics/TodoList_48.png" }
|
|
|
|
ListElement { name: "Contacts"; icon: "pics/AddressBook_48.png" }
|
|
|
|
}
|
2012-04-27 06:35:12 +00:00
|
|
|
//! [0]
|
|
|
|
GridView {
|
|
|
|
anchors.fill: parent
|
2023-06-28 13:30:40 +00:00
|
|
|
cellWidth: 100
|
|
|
|
cellHeight: 100
|
2012-04-27 06:35:12 +00:00
|
|
|
focus: true
|
|
|
|
model: appModel
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2023-06-28 13:30:40 +00:00
|
|
|
highlight: Rectangle {
|
|
|
|
width: 80
|
|
|
|
height: 80
|
|
|
|
color: "lightsteelblue"
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2012-04-27 06:35:12 +00:00
|
|
|
delegate: Item {
|
2019-09-17 16:10:59 +00:00
|
|
|
required property string icon
|
|
|
|
required property string name
|
|
|
|
required property int index
|
|
|
|
|
2023-06-28 13:30:40 +00:00
|
|
|
width: 100
|
|
|
|
height: 100
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
Image {
|
|
|
|
id: myIcon
|
2023-06-28 13:30:40 +00:00
|
|
|
y: 20
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2019-09-17 16:10:59 +00:00
|
|
|
source: parent.icon
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
Text {
|
2023-06-28 13:30:40 +00:00
|
|
|
anchors {
|
|
|
|
top: myIcon.bottom
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
2019-09-17 16:10:59 +00:00
|
|
|
text: parent.name
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
2012-02-03 04:43:05 +00:00
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
2019-09-17 16:10:59 +00:00
|
|
|
onClicked: parent.GridView.view.currentIndex = parent.index
|
2012-02-03 04:43:05 +00:00
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
2012-04-27 06:35:12 +00:00
|
|
|
//! [0]
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|