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>
This commit is contained in:
Dirk Hohndel 2021-01-11 08:49:23 -08:00
parent 6c315eaf21
commit 871e29d031
3 changed files with 28 additions and 7 deletions

View file

@ -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;

View file

@ -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
}
}

View file

@ -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>