| 1 |
import QtQuick 2.2 |
| 2 |
import QtQuick.Controls 1.1 |
| 3 |
import QtQuick.Layouts 1.1 |
| 4 |
|
| 5 |
Item { |
| 6 |
id: itemroot |
| 7 |
property string type |
| 8 |
property alias value: textValue.text |
| 9 |
property alias subtext: subtextValue.text |
| 10 |
property alias thisid: textValue |
| 11 |
property alias textColor: textValue.textColor |
| 12 |
property alias restrictions: textValue.inputMethodHints |
| 13 |
property alias maxLength: textValue.maximumLength |
| 14 |
property string helpLink |
| 15 |
signal clicked(); |
| 16 |
// Evil: hardcoded width/height |
| 17 |
height: (16.5) * 1.5 |
| 18 |
width: (16.5) * 15 |
| 19 |
ColumnLayout { |
| 20 |
RowLayout { |
| 21 |
id: topRow |
| 22 |
Layout.fillWidth: true |
| 23 |
Label { |
| 24 |
text: type |
| 25 |
font.bold: true |
| 26 |
Rectangle { |
| 27 |
visible: helpLink.length > 0 |
| 28 |
color: "#AAAAAA" |
| 29 |
anchors { left: parent.right; leftMargin: 5 } |
| 30 |
width: childrenRect.width |
| 31 |
height: childrenRect.height |
| 32 |
radius: 4 |
| 33 |
Label { |
| 34 |
text: "?" |
| 35 |
font.bold: true |
| 36 |
font.pointSize: 12 |
| 37 |
MouseArea { |
| 38 |
anchors.fill: parent |
| 39 |
onClicked: Qt.openUrlExternally(helpLink); |
| 40 |
} |
| 41 |
} |
| 42 |
} |
| 43 |
} |
| 44 |
TextField { |
| 45 |
id: textValue |
| 46 |
anchors {left: parent.left; leftMargin: itemroot.width / 2 - 10} |
| 47 |
text: value |
| 48 |
onAccepted: itemroot.clicked() |
| 49 |
} |
| 50 |
} |
| 51 |
Label { |
| 52 |
id: subtextValue |
| 53 |
anchors {left: parent.left; leftMargin: 10; top: parent.top; topMargin: topRow.implicitHeight - 2 } |
| 54 |
text: "" |
| 55 |
} |
| 56 |
} |
| 57 |
} |