Add themed chart layout to gui. Needs backend code.
This commit is contained in:
@@ -28,7 +28,7 @@ include(KDECompilerSettings NO_POLICY_SCOPE)
|
||||
|
||||
################# Find dependencies #################
|
||||
|
||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Svg QuickControls2 Bluetooth)
|
||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Svg QuickControls2 Bluetooth Charts)
|
||||
find_package(KF5Kirigami2 ${KF5_MIN_VERSION})
|
||||
|
||||
################# Enable C++11 features for clang and gcc #################
|
||||
|
||||
@@ -7,5 +7,5 @@ set(qiflora_SRCS
|
||||
|
||||
qt5_add_resources(RESOURCES resources.qrc)
|
||||
add_executable(qiflora ${qiflora_SRCS} ${RESOURCES})
|
||||
target_link_libraries(qiflora Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg Qt5::Bluetooth)
|
||||
target_link_libraries(qiflora Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg Qt5::Bluetooth Qt5::Charts)
|
||||
install(TARGETS qiflora ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
|
||||
@@ -2,6 +2,7 @@ import QtQuick 2.6
|
||||
import org.kde.kirigami 2.4 as Kirigami
|
||||
import QtQuick.Controls 2.0 as Controls
|
||||
import QtQuick.Layouts 1.12 as Layouts
|
||||
import QtCharts 2.3 as Charts
|
||||
import org.eyecreate.qiflora 1.0
|
||||
|
||||
Kirigami.ApplicationWindow {
|
||||
@@ -30,10 +31,10 @@ Kirigami.ApplicationWindow {
|
||||
title: "Monitor"
|
||||
|
||||
Component.onCompleted: {
|
||||
monitorTypes.append({"chartType": "temperature", "title": i18n("Temperature"), "icon": "filename-bpm-amarok"});
|
||||
monitorTypes.append({"chartType": "moisture", "title": i18n("Moisture"), "icon": "colors-chromablue"});
|
||||
monitorTypes.append({"chartType": "conductivity", "title": i18n("Conductivity"), "icon": "quickopen"});
|
||||
monitorTypes.append({"chartType": "brightness", "title": i18n("Brightness"), "icon": "contrast"});
|
||||
monitorTypes.append({"chartType": "temperature", "title": i18n("Temperature"), "icon": "filename-bpm-amarok", "lineColor": "red"});
|
||||
monitorTypes.append({"chartType": "moisture", "title": i18n("Moisture"), "icon": "colors-chromablue", "lineColor": "cyan"});
|
||||
monitorTypes.append({"chartType": "conductivity", "title": i18n("Conductivity"), "icon": "quickopen", "lineColor": "green"});
|
||||
monitorTypes.append({"chartType": "brightness", "title": i18n("Brightness"), "icon": "contrast", "lineColor": "yellow"});
|
||||
}
|
||||
|
||||
Kirigami.CardsListView {
|
||||
@@ -71,10 +72,30 @@ Kirigami.ApplicationWindow {
|
||||
}
|
||||
}
|
||||
}
|
||||
contentItem: Controls.Label {
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("") //TODO: replace with graph?
|
||||
contentItem: Item {
|
||||
implicitWidth: 300
|
||||
implicitHeight: 200
|
||||
Charts.ChartView {
|
||||
antialiasing: true
|
||||
backgroundColor: Kirigami.Theme.backgroundColor
|
||||
titleColor: Kirigami.Theme.textColor
|
||||
legend.visible: false
|
||||
anchors.fill: parent
|
||||
Charts.LineSeries {
|
||||
axisX: Charts.ValueAxis {
|
||||
labelsColor: Kirigami.Theme.textColor
|
||||
titleText: i18n("Hours")
|
||||
}
|
||||
axisY: Charts.ValueAxis {
|
||||
labelsColor: Kirigami.Theme.textColor
|
||||
}
|
||||
color: model.lineColor
|
||||
name: model.title
|
||||
Charts.XYPoint{x: 1; y: 1}
|
||||
Charts.XYPoint{x: 2; y: 2}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user