diff options
Diffstat (limited to 'qml/LaunchScreen.qml')
-rw-r--r-- | qml/LaunchScreen.qml | 108 |
1 files changed, 33 insertions, 75 deletions
diff --git a/qml/LaunchScreen.qml b/qml/LaunchScreen.qml index 1d43b7b..0b888c1 100644 --- a/qml/LaunchScreen.qml +++ b/qml/LaunchScreen.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt for Device Creation. @@ -27,89 +27,47 @@ ** ****************************************************************************/ import QtQuick 2.0 +import QtQuick.Controls 2.1 Item { + id: gridroot + anchors.fill: parent - id: root - - property real size: Math.min(root.width, root.height); - property int itemsPerScreen: 2 - property int offset: 10 - - PathView { - id: list - y: 10 - width: parent.width - height: parent.height - property real cellWidth: (list.width - (root.itemsPerScreen - 1) /** list.spacing*/) / root.itemsPerScreen - property real cellHeight: (list.height / root.itemsPerScreen) - - maximumFlickVelocity: 5000 - - pathItemCount: list.count + GridView { + id: grid + anchors.fill: parent + anchors.margins: viewSettings.pageMargin * 0.5 + anchors.topMargin: viewSettings.pageMargin + cellWidth: width / 3 + cellHeight: cellWidth + clip: true model: applicationsModel; - preferredHighlightBegin: 1/(list.count/2) - preferredHighlightEnd: 1 - currentIndex: -1 - - path: Path { - startX: -list.cellWidth - offset*2; startY: list.y + list.cellHeight/2 - PathLine{ x: (list.cellWidth + offset)*list.count - list.cellWidth - offset*2; y: list.y + list.cellHeight/2} - } - highlightMoveDuration: 700 - dragMargin: list.height - delegate: ApplicationIcon { - id: iconRoot; - width: list.cellWidth - height: list.cellHeight - function select() { - list.currentIndex = index; - } - onClicked: { - select() - } + delegate: GridViewIcon { + id: iconRoot2; + height: grid.cellHeight + width: grid.cellWidth + onClicked: root.launchApplication(sLocation, sMainFile, sName, sDescription) } + ScrollBar.vertical: ScrollBar { + parent: gridroot + anchors.top: grid.top + anchors.bottom: grid.bottom + anchors.right: parent.right + anchors.rightMargin: viewSettings.pageMargin * 0.25 + anchors.topMargin: viewSettings.pageMargin * 0.5 + width: viewSettings.pageMargin * 0.5 + size: 0.3 + position: 0.2 + active: true + orientation: Qt.Vertical - onCurrentIndexChanged: { - if (list.currentIndex >= 0) { - descriptionLabel.text = applicationsModel.query(list.currentIndex, "description"); - nameLabel.text = applicationsModel.query(list.currentIndex, "name"); - } else { - descriptionLabel.text = "" - nameLabel.text = "" + contentItem: Rectangle { + implicitWidth: viewSettings.pageMargin * 0.25 + implicitHeight: root.height * 0.1 + color: "#41cd52" } } - - onCountChanged: if (count > 0 && currentIndex < 0) currentIndex = 0 - } - - Text { - id: nameLabel - anchors.horizontalCenter: parent.horizontalCenter - horizontalAlignment: Text.AlignHCenter - y: list.cellHeight + engine.mm(10) - width: list.cellWidth - engine.mm(2) - font.pixelSize: engine.fontSize() - color: "black" - font.bold: true - wrapMode: Text.WordWrap - textFormat: Text.PlainText - renderType: Text.NativeRendering - } - - Text { - id: descriptionLabel - width: nameLabel.width - font.pixelSize: engine.smallFontSize() - color: "black" - x: nameLabel.x - anchors.top: nameLabel.bottom - anchors.topMargin: engine.fontSize() - anchors.bottom: parent.bottom - wrapMode: Text.WordWrap - textFormat: Text.PlainText - renderType: Text.NativeRendering } } |