summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-10 18:28:20 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-01-10 15:16:52 -0800
commit5cfa13694c1cbb8954c9629f91f9f56702f21117 (patch)
tree13e004a748faf9b7c879b71f308a612ee9ab88cb /mobile-widgets
parent9a0c5df74427fee8a9788fbb20165b03cf389906 (diff)
downloadsubsurface-5cfa13694c1cbb8954c9629f91f9f56702f21117.tar.gz
statistics/mobile: add variable2 operations combo-box
Copy paste of the other combo boxes. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qml/StatisticsPage.qml18
-rw-r--r--mobile-widgets/statsmanager.cpp12
-rw-r--r--mobile-widgets/statsmanager.h7
3 files changed, 37 insertions, 0 deletions
diff --git a/mobile-widgets/qml/StatisticsPage.qml b/mobile-widgets/qml/StatisticsPage.qml
index 7c5b498ca..3fcfdfcc2 100644
--- a/mobile-widgets/qml/StatisticsPage.qml
+++ b/mobile-widgets/qml/StatisticsPage.qml
@@ -98,6 +98,24 @@ Kirigami.Page {
}
}
}
+ ColumnLayout {
+ id: i5
+ Layout.column: wide ? 0 : 2
+ Layout.row: wide ? 4 : 1
+ Layout.margins: Kirigami.Units.smallSpacing
+ TemplateLabelSmall {
+ text: qsTr("Operation")
+ }
+ TemplateComboBox {
+ id: var2Operation
+ model: statsManager.operation2List
+ currentIndex: statsManager.operation2Index;
+ Layout.fillWidth: false
+ onCurrentIndexChanged: {
+ statsManager.var2OperationChanged(currentIndex)
+ }
+ }
+ }
Item {
Layout.column: wide ? 0 : 4
Layout.row: wide ? 4 : 0
diff --git a/mobile-widgets/statsmanager.cpp b/mobile-widgets/statsmanager.cpp
index 8a192fe36..639b9294a 100644
--- a/mobile-widgets/statsmanager.cpp
+++ b/mobile-widgets/statsmanager.cpp
@@ -51,14 +51,17 @@ void StatsManager::updateUi()
setBinnerList(uiState.binners1, binner1List, binner1Index);
setVariableList(uiState.var2, var2List, var2Index);
setBinnerList(uiState.binners2, binner2List, binner2Index);
+ setVariableList(uiState.operations2, operation2List, operation2Index);
var1ListChanged();
binner1ListChanged();
var2ListChanged();
binner2ListChanged();
+ operation2ListChanged();
var1IndexChanged();
binner1IndexChanged();
var2IndexChanged();
binner2IndexChanged();
+ operation2IndexChanged();
if (view)
view->plot(state);
@@ -93,3 +96,12 @@ void StatsManager::var2BinnerChanged(int idx)
state.binner2Changed(idx);
updateUi();
}
+
+void StatsManager::var2OperationChanged(int idx)
+{
+ if (uiState.var2.variables.empty())
+ return;
+ idx = std::clamp(idx, 0, (int)uiState.operations2.variables.size());
+ state.var2OperationChanged(uiState.operations2.variables[idx].id);
+ updateUi();
+}
diff --git a/mobile-widgets/statsmanager.h b/mobile-widgets/statsmanager.h
index c4afa6881..82c7a6b89 100644
--- a/mobile-widgets/statsmanager.h
+++ b/mobile-widgets/statsmanager.h
@@ -14,10 +14,12 @@ public:
Q_PROPERTY(QStringList binner1List MEMBER binner1List NOTIFY binner1ListChanged)
Q_PROPERTY(QStringList var2List MEMBER var2List NOTIFY var2ListChanged)
Q_PROPERTY(QStringList binner2List MEMBER binner2List NOTIFY binner2ListChanged)
+ Q_PROPERTY(QStringList operation2List MEMBER operation2List NOTIFY operation2ListChanged)
Q_PROPERTY(int var1Index MEMBER var1Index NOTIFY var1IndexChanged)
Q_PROPERTY(int binner1Index MEMBER binner1Index NOTIFY binner1IndexChanged)
Q_PROPERTY(int var2Index MEMBER var2Index NOTIFY var2IndexChanged)
Q_PROPERTY(int binner2Index MEMBER binner2Index NOTIFY binner2IndexChanged)
+ Q_PROPERTY(int operation2Index MEMBER operation2Index NOTIFY operation2IndexChanged)
StatsManager();
~StatsManager();
@@ -27,15 +29,18 @@ public:
Q_INVOKABLE void var1BinnerChanged(int idx);
Q_INVOKABLE void var2Changed(int idx);
Q_INVOKABLE void var2BinnerChanged(int idx);
+ Q_INVOKABLE void var2OperationChanged(int idx);
signals:
void var1ListChanged();
void binner1ListChanged();
void var2ListChanged();
void binner2ListChanged();
+ void operation2ListChanged();
void var1IndexChanged();
void binner1IndexChanged();
void var2IndexChanged();
void binner2IndexChanged();
+ void operation2IndexChanged();
private:
StatsView *view;
StatsState state;
@@ -43,10 +48,12 @@ private:
QStringList binner1List;
QStringList var2List;
QStringList binner2List;
+ QStringList operation2List;
int var1Index;
int binner1Index;
int var2Index;
int binner2Index;
+ int operation2Index;
StatsState::UIState uiState; // Remember UI state so that we can interpret indexes
void updateUi();