mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	The standard SpinBox uses far too much real estate. The new SpinBox have a smaller footprint, and more visual effect. Changing the TemplateSpinBox, automatically changes all spinboxes in the system, converted to the new layout. The styling would be better in a style/theme class, but subsurfaceTheme is in main.qml and not in a C++ class, so for now use primitive styling. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
		
			
				
	
	
		
			68 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			QML
		
	
	
	
	
	
			
		
		
	
	
			68 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			QML
		
	
	
	
	
	
| // SPDX-License-Identifier: GPL-2.0
 | |
| import QtQuick 2.11
 | |
| import QtQuick.Controls 2.4
 | |
| import QtQuick.Layouts 1.11
 | |
| 
 | |
| SpinBox {
 | |
| 	id: control
 | |
| 	editable: true
 | |
| 	font.pointSize: subsurfaceTheme.regularPointSize
 | |
| 
 | |
| 	contentItem: TextInput {
 | |
| 		z: 2
 | |
| 		text: control.textFromValue(control.value, control.locale)
 | |
| 
 | |
| 		font: control.font
 | |
| 		color: control.enabled ? "black" : "lightgrey"
 | |
| 		horizontalAlignment: Qt.AlignHCenter
 | |
| 		verticalAlignment: Qt.AlignVCenter
 | |
| 
 | |
| 		readOnly: !control.editable
 | |
| 		validator: control.validator
 | |
| 		inputMethodHints: Qt.ImhFormattedNumbersOnly
 | |
| 	}
 | |
| 
 | |
| 	up.indicator: Rectangle {
 | |
| 		x: control.mirrored ? 0 : parent.width - width
 | |
| 		height: control.height
 | |
| 		implicitWidth: 30
 | |
| 		implicitHeight: 30
 | |
| 		color: control.enabled ? "grey" : "lightgrey"
 | |
| 		border.color: control.enabled ? "grey" : "lightgrey"
 | |
| 
 | |
| 		Text {
 | |
| 			text: "+"
 | |
| 			font.pixelSize: control.font.pixelSize * 2
 | |
| 			color: control.enabled ? "black" : "lightgrey"
 | |
| 			anchors.fill: parent
 | |
| 			fontSizeMode: Text.Fit
 | |
| 			horizontalAlignment: Text.AlignHCenter
 | |
| 			verticalAlignment: Text.AlignVCenter
 | |
| 		}
 | |
| 	}
 | |
| 
 | |
| 	down.indicator: Rectangle {
 | |
| 		x: control.mirrored ? parent.width - width : 0
 | |
| 		height: control.height
 | |
| 		implicitWidth: 30
 | |
| 		implicitHeight: 30
 | |
| 		color: control.enabled ? "grey" : "lightgrey"
 | |
| 		border.color: control.enabled ? "grey" : "lightgrey"
 | |
| 
 | |
| 		Text {
 | |
| 			text: "-"
 | |
| 			font.pixelSize: control.font.pixelSize * 2
 | |
| 			color: control.enabled ? "black" : "lightgrey"
 | |
| 			anchors.fill: parent
 | |
| 			fontSizeMode: Text.Fit
 | |
| 			horizontalAlignment: Text.AlignHCenter
 | |
| 			verticalAlignment: Text.AlignVCenter
 | |
| 		}
 | |
| 	}
 | |
| 
 | |
| 	background: Rectangle {
 | |
| 		implicitWidth: 140
 | |
| 		color: subsurfaceTheme.backgroundColor
 | |
| 		border.color: subsurfaceTheme.backgroundColor
 | |
| 	}
 | |
| }
 |