Warning, /frameworks/kquickcharts/examples/charts/main.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * This file is part of KQuickCharts
0003  * SPDX-FileCopyrightText: 2019 Arjen Hiemstra <ahiemstra@heimr.nl>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006  */
0007 
0008 import QtQuick
0009 import QtQuick.Controls
0010 
0011 import org.kde.kirigami as Kirigami
0012 
0013 Kirigami.ApplicationWindow {
0014     id: window
0015     title: "Charts Example"
0016 
0017     pageStack.initialPage: Kirigami.ScrollablePage {
0018         title: "Charts"
0019 
0020         ListView {
0021 
0022             model: ListModel {
0023                 id: pagesModel
0024                 ListElement { label: "Pie Chart"; file: "qrc:/PieChart.qml"; identifier: "pie" }
0025                 ListElement { label: "Line Chart"; file: "qrc:/LineChart.qml"; identifier: "line" }
0026                 ListElement { label: "Bar Chart"; file: "qrc:/BarChart.qml"; identifier: "bar" }
0027                 ListElement { label: "History Proxy Source"; file: "qrc:/HistoryProxySource.qml"; identifier: "history" }
0028                 ListElement { label: "Legend"; file: "qrc:/Legend.qml"; identifier: "legend" }
0029             }
0030 
0031             delegate: ItemDelegate {
0032                 width: ListView.view.width
0033 
0034                 text: model.label
0035                 onClicked: applicationWindow().pageStack.push(model.file);
0036 
0037                 Kirigami.Separator { width: parent.width }
0038             }
0039         }
0040     }
0041 
0042     Component.onCompleted: {
0043         if (__commandLinePage !== null) {
0044             for (var i = 0; i < pagesModel.count; ++i) {
0045                 var item = pagesModel.get(i);
0046                 if (item.identifier == __commandLinePage || item.label == __commandLinePage) {
0047                     window.pageStack.push(item.file);
0048                     return;
0049                 }
0050             }
0051         }
0052     }
0053 }