12 changed files with 120 additions and 11 deletions
			
			
		| 
		 After Width: | Height: | Size: 210 B  | 
@ -0,0 +1,31 @@ | 
				
			|||
import QtQuick 2.10 | 
				
			|||
import QtQuick.Controls 2.3 | 
				
			|||
import QtQuick.Layouts 1.3 | 
				
			|||
 | 
				
			|||
ItemDelegate { | 
				
			|||
	id: _listDelegate | 
				
			|||
 | 
				
			|||
	text: title | 
				
			|||
 | 
				
			|||
	signal showInput(string key, string title, string type, var defaultValue, var properties); | 
				
			|||
 | 
				
			|||
	contentItem: ColumnLayout { | 
				
			|||
		Label { | 
				
			|||
			id: _titleLabel | 
				
			|||
			text: _listDelegate.text | 
				
			|||
			font.bold: true | 
				
			|||
			elide: Label.ElideRight | 
				
			|||
			Layout.fillWidth: true | 
				
			|||
		} | 
				
			|||
 | 
				
			|||
		Label { | 
				
			|||
			id: _textLabel | 
				
			|||
			visible: tooltip | 
				
			|||
			text: tooltip | 
				
			|||
			wrapMode: Text.WordWrap | 
				
			|||
			Layout.fillWidth: true | 
				
			|||
		} | 
				
			|||
	} | 
				
			|||
 | 
				
			|||
	onClicked: showInput(key, title, "radiolist", inputValue, properties) | 
				
			|||
} | 
				
			|||
@ -0,0 +1,27 @@ | 
				
			|||
import QtQuick 2.10 | 
				
			|||
import QtQuick.Controls 2.3 | 
				
			|||
 | 
				
			|||
ListView { | 
				
			|||
	id: _edit | 
				
			|||
	property var inputValue | 
				
			|||
	property alias listElements: _edit.model | 
				
			|||
	readonly property bool isExtended: Boolean(model[0] && model[0].name) | 
				
			|||
 | 
				
			|||
	implicitHeight: dummyDelegate.height * model.length | 
				
			|||
 | 
				
			|||
	ScrollBar.vertical: ScrollBar {} | 
				
			|||
 | 
				
			|||
	delegate: RadioDelegate { | 
				
			|||
		width: parent.width | 
				
			|||
		text: isExtended ? _edit.model[index].name : modelData | 
				
			|||
 | 
				
			|||
		checked: (isExtended ? _edit.model[index].value : modelData) == inputValue | 
				
			|||
		onClicked: inputValue = (isExtended ? _edit.model[index].value : modelData) | 
				
			|||
	} | 
				
			|||
 | 
				
			|||
	RadioDelegate { | 
				
			|||
		id:dummyDelegate | 
				
			|||
		visible: false | 
				
			|||
		text: "dummy" | 
				
			|||
	} | 
				
			|||
} | 
				
			|||
					Loading…
					
					
				
		Reference in new issue