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 2.9
0009 import QtQuick.Controls 2.2
0010 
0011 import org.kde.kirigami 2.2 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: Kirigami.BasicListItem {
0032                 label: model.label
0033                 onClicked: applicationWindow().pageStack.push(model.file);
0034             }
0035         }
0036     }
0037 
0038     Component.onCompleted: {
0039         if (__commandLinePage !== null) {
0040             for (var i = 0; i < pagesModel.count; ++i) {
0041                 var item = pagesModel.get(i);
0042                 if (item.identifier == __commandLinePage || item.label == __commandLinePage) {
0043                     window.pageStack.push(item.file);
0044                     return;
0045                 }
0046             }
0047         }
0048     }
0049 }