mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	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:
		
							parent
							
								
									6c315eaf21
								
							
						
					
					
						commit
						871e29d031
					
				
					 3 changed files with 28 additions and 7 deletions
				
			
		| 
						 | 
					@ -43,11 +43,10 @@ Kirigami.Page {
 | 
				
			||||||
			TemplateLabelSmall {
 | 
								TemplateLabelSmall {
 | 
				
			||||||
				text: qsTr("Base variable")
 | 
									text: qsTr("Base variable")
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			TemplateComboBox  {
 | 
								TemplateSlimComboBox  {
 | 
				
			||||||
				id: var1
 | 
									id: var1
 | 
				
			||||||
				model: statsManager.var1List
 | 
									model: statsManager.var1List
 | 
				
			||||||
				currentIndex: statsManager.var1Index;
 | 
									currentIndex: statsManager.var1Index;
 | 
				
			||||||
				Layout.fillWidth: false
 | 
					 | 
				
			||||||
				onCurrentIndexChanged: {
 | 
									onCurrentIndexChanged: {
 | 
				
			||||||
					statsManager.var1Changed(currentIndex)
 | 
										statsManager.var1Changed(currentIndex)
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
| 
						 | 
					@ -61,11 +60,10 @@ Kirigami.Page {
 | 
				
			||||||
			TemplateLabelSmall {
 | 
								TemplateLabelSmall {
 | 
				
			||||||
				text: qsTr("Binning")
 | 
									text: qsTr("Binning")
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			TemplateComboBox {
 | 
								TemplateSlimComboBox {
 | 
				
			||||||
				id: var1Binner
 | 
									id: var1Binner
 | 
				
			||||||
				model: statsManager.binner1List
 | 
									model: statsManager.binner1List
 | 
				
			||||||
				currentIndex: statsManager.binner1Index;
 | 
									currentIndex: statsManager.binner1Index;
 | 
				
			||||||
				Layout.fillWidth: false
 | 
					 | 
				
			||||||
				onCurrentIndexChanged: {
 | 
									onCurrentIndexChanged: {
 | 
				
			||||||
					statsManager.var1BinnerChanged(currentIndex)
 | 
										statsManager.var1BinnerChanged(currentIndex)
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
| 
						 | 
					@ -79,7 +77,7 @@ Kirigami.Page {
 | 
				
			||||||
			TemplateLabelSmall {
 | 
								TemplateLabelSmall {
 | 
				
			||||||
				text: qsTr("Data")
 | 
									text: qsTr("Data")
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			TemplateComboBox {
 | 
								TemplateSlimComboBox {
 | 
				
			||||||
				id: var2
 | 
									id: var2
 | 
				
			||||||
				model: statsManager.var2List
 | 
									model: statsManager.var2List
 | 
				
			||||||
				currentIndex: statsManager.var2Index;
 | 
									currentIndex: statsManager.var2Index;
 | 
				
			||||||
| 
						 | 
					@ -97,7 +95,7 @@ Kirigami.Page {
 | 
				
			||||||
			TemplateLabelSmall {
 | 
								TemplateLabelSmall {
 | 
				
			||||||
				text: qsTr("Binning")
 | 
									text: qsTr("Binning")
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			TemplateComboBox {
 | 
								TemplateSlimComboBox {
 | 
				
			||||||
				id: var2Binner
 | 
									id: var2Binner
 | 
				
			||||||
				model: statsManager.binner2List
 | 
									model: statsManager.binner2List
 | 
				
			||||||
				currentIndex: statsManager.binner2Index;
 | 
									currentIndex: statsManager.binner2Index;
 | 
				
			||||||
| 
						 | 
					@ -115,7 +113,7 @@ Kirigami.Page {
 | 
				
			||||||
			TemplateLabelSmall {
 | 
								TemplateLabelSmall {
 | 
				
			||||||
				text: qsTr("Operation")
 | 
									text: qsTr("Operation")
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			TemplateComboBox {
 | 
								TemplateSlimComboBox {
 | 
				
			||||||
				id: var2Operation
 | 
									id: var2Operation
 | 
				
			||||||
				model: statsManager.operation2List
 | 
									model: statsManager.operation2List
 | 
				
			||||||
				currentIndex: statsManager.operation2Index;
 | 
									currentIndex: statsManager.operation2Index;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										22
									
								
								mobile-widgets/qml/TemplateSlimComboBox.qml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								mobile-widgets/qml/TemplateSlimComboBox.qml
									
										
									
									
									
										Normal 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
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -4,6 +4,7 @@
 | 
				
			||||||
		<file>TemplateButton.qml</file>
 | 
							<file>TemplateButton.qml</file>
 | 
				
			||||||
		<file>TemplateCheckBox.qml</file>
 | 
							<file>TemplateCheckBox.qml</file>
 | 
				
			||||||
		<file>TemplateComboBox.qml</file>
 | 
							<file>TemplateComboBox.qml</file>
 | 
				
			||||||
 | 
							<file>TemplateSlimComboBox.qml</file>
 | 
				
			||||||
		<file>TemplateEditComboBox.qml</file>
 | 
							<file>TemplateEditComboBox.qml</file>
 | 
				
			||||||
		<file>TemplateLabel.qml</file>
 | 
							<file>TemplateLabel.qml</file>
 | 
				
			||||||
		<file>TemplateLabelSmall.qml</file>
 | 
							<file>TemplateLabelSmall.qml</file>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue