swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 1 | import QtQuick 2.0 |
| 2 | import QtQuick.Controls 2.15 |
| 3 | import QtQuick.Controls.Material 2.0 |
| 4 | import QtQuick.Layouts 1.0 |
| 5 | |
| 6 | ColumnLayout { |
| 7 | id: root |
| 8 | |
swissChili | 4b3105a | 2022-02-22 16:34:39 -0800 | [diff] [blame^] | 9 | required property string code |
| 10 | required property string result |
| 11 | |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 12 | RowLayout { |
| 13 | Layout.fillWidth: true |
| 14 | |
| 15 | Button { |
| 16 | Layout.alignment: Qt.AlignTop |
| 17 | icon.source: "qrc:///icons/play-circle.svg" |
| 18 | icon.color: Material.color(Material.Grey, Material.Shade600) |
| 19 | flat: true |
| 20 | } |
| 21 | |
| 22 | ColumnLayout { |
| 23 | Layout.fillWidth: true |
| 24 | Layout.fillHeight: true |
| 25 | |
| 26 | TextArea { |
| 27 | Layout.fillWidth: true |
| 28 | Layout.fillHeight: true |
| 29 | id: code |
| 30 | font.family: "monospace" |
swissChili | 4b3105a | 2022-02-22 16:34:39 -0800 | [diff] [blame^] | 31 | text: root.code |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 32 | selectByMouse: true |
| 33 | wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere |
swissChili | 4b3105a | 2022-02-22 16:34:39 -0800 | [diff] [blame^] | 34 | |
| 35 | Keys.onTabPressed: { |
| 36 | var pos = cursorPosition + 4 |
| 37 | text += " "; |
| 38 | cursorPosition = pos |
| 39 | } |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | Label { |
| 43 | Layout.fillWidth: true |
| 44 | font.family: "monospace" |
swissChili | 4b3105a | 2022-02-22 16:34:39 -0800 | [diff] [blame^] | 45 | text: root.result |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 46 | } |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | InsertRow { |
| 51 | |
| 52 | } |
| 53 | } |