diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2021-01-11 08:49:23 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-01-12 08:31:35 -0800 |
commit | 871e29d03189d55f2ba725e284132b39da3d94e7 (patch) | |
tree | f21a57d323160064429c9d7e34cc2c2c83f0f838 /mobile-widgets/qml | |
parent | 6c315eaf218885db43522bb1122cbb882f57196a (diff) | |
download | subsurface-871e29d03189d55f2ba725e284132b39da3d94e7.tar.gz |
mobile/UI: add another variation of the combo box
This one is designed to be fixed size and space efficient, non editable.
It's used in the statistics page for now and looks much better than what
we have elsewhere, so the style should propagate to the rest of them as
well, but this is trickier for the once that are editable - and of
course the fixed width might also not be appropriate in other places.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qml')
-rw-r--r-- | mobile-widgets/qml/StatisticsPage.qml | 12 | ||||
-rw-r--r-- | mobile-widgets/qml/TemplateSlimComboBox.qml | 22 | ||||
-rw-r--r-- | mobile-widgets/qml/mobile-resources.qrc | 1 |
3 files changed, 28 insertions, 7 deletions
diff --git a/mobile-widgets/qml/StatisticsPage.qml b/mobile-widgets/qml/StatisticsPage.qml index fe6e3666d..2948dd067 100644 --- a/mobile-widgets/qml/StatisticsPage.qml +++ b/mobile-widgets/qml/StatisticsPage.qml @@ -43,11 +43,10 @@ Kirigami.Page { TemplateLabelSmall { text: qsTr("Base variable") } - TemplateComboBox { + TemplateSlimComboBox { id: var1 model: statsManager.var1List currentIndex: statsManager.var1Index; - Layout.fillWidth: false onCurrentIndexChanged: { statsManager.var1Changed(currentIndex) } @@ -61,11 +60,10 @@ Kirigami.Page { TemplateLabelSmall { text: qsTr("Binning") } - TemplateComboBox { + TemplateSlimComboBox { id: var1Binner model: statsManager.binner1List currentIndex: statsManager.binner1Index; - Layout.fillWidth: false onCurrentIndexChanged: { statsManager.var1BinnerChanged(currentIndex) } @@ -79,7 +77,7 @@ Kirigami.Page { TemplateLabelSmall { text: qsTr("Data") } - TemplateComboBox { + TemplateSlimComboBox { id: var2 model: statsManager.var2List currentIndex: statsManager.var2Index; @@ -97,7 +95,7 @@ Kirigami.Page { TemplateLabelSmall { text: qsTr("Binning") } - TemplateComboBox { + TemplateSlimComboBox { id: var2Binner model: statsManager.binner2List currentIndex: statsManager.binner2Index; @@ -115,7 +113,7 @@ Kirigami.Page { TemplateLabelSmall { text: qsTr("Operation") } - TemplateComboBox { + TemplateSlimComboBox { id: var2Operation model: statsManager.operation2List currentIndex: statsManager.operation2Index; diff --git a/mobile-widgets/qml/TemplateSlimComboBox.qml b/mobile-widgets/qml/TemplateSlimComboBox.qml new file mode 100644 index 000000000..36137770a --- /dev/null +++ b/mobile-widgets/qml/TemplateSlimComboBox.qml @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0 +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 +import org.kde.kirigami 2.4 as Kirigami + +TemplateComboBox { + id: cb + Layout.fillWidth: false + Layout.preferredHeight: Kirigami.Units.gridUnit * 2 + Layout.preferredWidth: Kirigami.Units.gridUnit * 8 + contentItem: Text { + text: cb.displayText + font.pointSize: subsurfaceTheme.regularPointSize + anchors.right: indicator.left + anchors.left: cb.left + color: subsurfaceTheme.textColor + leftPadding: Kirigami.Units.smallSpacing * 0.5 + rightPadding: Kirigami.Units.smallSpacing * 0.5 + verticalAlignment: Text.AlignVCenter + } +} diff --git a/mobile-widgets/qml/mobile-resources.qrc b/mobile-widgets/qml/mobile-resources.qrc index d0b285ab6..ffbaaac88 100644 --- a/mobile-widgets/qml/mobile-resources.qrc +++ b/mobile-widgets/qml/mobile-resources.qrc @@ -4,6 +4,7 @@ <file>TemplateButton.qml</file> <file>TemplateCheckBox.qml</file> <file>TemplateComboBox.qml</file> + <file>TemplateSlimComboBox.qml</file> <file>TemplateEditComboBox.qml</file> <file>TemplateLabel.qml</file> <file>TemplateLabelSmall.qml</file> |