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 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick.Controls as QQC2
import "Style"
PathView {
id: circularView
signal launched(string page)
readonly property int cX: width / 2
readonly property int cY: height / 2
readonly property int itemSize: size / 4
readonly property int size: Math.min(width - 80, height)
readonly property int radius: size / 2 - itemSize / 3
snapMode: PathView.SnapToItem
model: ListModel {
ListElement {
title: qsTr("World Clock")
icon: "worldclock"
page: "WorldClock/WorldClockPage.qml"
}
ListElement {
title: qsTr("Navigation")
icon: "navigation"
page: "Navigation/NavigationPage.qml"
}
ListElement {
title: qsTr("Weather")
icon: "weather"
page: "Weather/WeatherPage.qml"
}
ListElement {
title: qsTr("Fitness")
icon: "fitness"
page: "Fitness/FitnessPage.qml"
}
ListElement {
title: qsTr("Notifications")
icon: "notifications"
page: "Notifications/NotificationsPage.qml"
}
ListElement {
title: qsTr("Alarm")
icon: "alarms"
page: "Alarms/AlarmsPage.qml"
}
ListElement {
title: qsTr("Settings")
icon: "settings"
page: "Settings/SettingsPage.qml"
}
}
delegate: QQC2.RoundButton {
width: circularView.itemSize
height: circularView.itemSize
property string title: model.title
icon.width: 36
icon.height: 36
icon.name: model.icon
opacity: PathView.itemOpacity
padding: 12
background: Rectangle {
radius: width / 2
border.width: 3
border.color: parent.PathView.isCurrentItem ? UIStyle.colorQtPrimGreen : UIStyle.themeColorQtGray4
}
onClicked: {
if (PathView.isCurrentItem)
circularView.launched(Qt.resolvedUrl(page))
else
circularView.currentIndex = index
}
}
path: Path {
startX: circularView.cX
startY: circularView.cY
PathAttribute {
name: "itemOpacity"
value: 1.0
}
PathLine {
x: circularView.cX + circularView.radius
y: circularView.cY
}
PathAttribute {
name: "itemOpacity"
value: 0.7
}
PathArc {
x: circularView.cX - circularView.radius
y: circularView.cY
radiusX: circularView.radius
radiusY: circularView.radius
useLargeArc: true
direction: PathArc.Clockwise
}
PathAttribute {
name: "itemOpacity"
value: 0.5
}
PathArc {
x: circularView.cX + circularView.radius
y: circularView.cY
radiusX: circularView.radius
radiusY: circularView.radius
useLargeArc: true
direction: PathArc.Clockwise
}
PathAttribute {
name: "itemOpacity"
value: 0.3
}
}
Text {
id: appTitle
property Item currentItem: circularView.currentItem
visible: currentItem ? currentItem.PathView.itemOpacity === 1.0 : 0
text: currentItem ? currentItem.title : ""
anchors.centerIn: parent
anchors.verticalCenterOffset: (circularView.itemSize + height) / 2
font.bold: true
font.pixelSize: circularView.itemSize / 3
font.letterSpacing: 1
color: UIStyle.themeColorQtGray1
}
}
|