Warning, /rolisteam/rolisteam/src/libraries/charactersheet/qml/Rolisteam/SelectField.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick
0002 import QtQuick.Controls
0003 
0004 ComboBox {
0005     id:root
0006     property int selected
0007     property var selectedValue
0008     property bool defined: false
0009     property string text: ""
0010     property string tooltip: ""
0011     property color textColor:"black"
0012     property int hAlign: 0
0013     property int vAlign: 0
0014     property bool readOnly: false
0015     property alias color: back.color
0016 
0017     enabled: !readOnly
0018     bottomPadding: 0
0019     leftPadding: 0
0020     rightPadding: 0
0021     topPadding: 0
0022     padding: 0
0023     spacing: 0
0024 
0025     ToolTip.text: root.tooltip
0026     ToolTip.visible: root.tooltip.length >0 && pressed
0027 
0028     property alias availableValues: root.model
0029     property bool clippedText: false
0030     Component.onCompleted:{
0031         currentIndex = selected
0032         defined = true
0033     }
0034     onSelectedChanged:{
0035         if(currentIndex !== selected)
0036         {
0037             currentIndex = selected
0038         }
0039     }
0040 
0041     background: Rectangle {
0042         id: back
0043     }
0044 
0045     contentItem: Text {
0046       leftPadding: 0
0047       rightPadding: 0
0048 
0049       text: root.displayText
0050       font: root.font
0051       verticalAlignment: Text.AlignVCenter
0052       horizontalAlignment: Text.AlignHCenter
0053       elide: Text.ElideRight
0054     }
0055     indicator: Canvas {
0056               id: canvas
0057               x: root.width - width
0058               y: (root.availableHeight - height) / 2
0059               width: 12
0060               height: 8
0061               contextType: "2d"
0062 
0063               Connections {
0064                   target: root
0065                   onPressedChanged: canvas.requestPaint()
0066               }
0067 
0068               onPaint: {
0069                   context.reset();
0070                   context.moveTo(0, 0);
0071                   context.lineTo(width, 0);
0072                   context.lineTo(width / 2, height);
0073                   context.closePath();
0074                   context.fillStyle = "black";
0075                   context.fill();
0076               }
0077     }
0078     onCountChanged: {
0079         currentIndex=selected
0080     }
0081 }
0082