swissChili | ece1ac8 | 2022-02-25 11:20:42 -0800 | [diff] [blame] | 1 | import QtQuick 2.5 |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 2 | import QtQuick.Controls 2.15 |
| 3 | import QtQuick.Controls.Material 2.0 |
| 4 | import QtQuick.Layouts 1.0 |
| 5 | |
| 6 | Rectangle { |
| 7 | id: root |
| 8 | |
swissChili | 25620b0 | 2022-02-23 17:15:16 -0800 | [diff] [blame] | 9 | signal insertClicked() |
| 10 | |
swissChili | 4b3105a | 2022-02-22 16:34:39 -0800 | [diff] [blame] | 11 | color: Material.color(Material.Grey, Material.theme == Material.Dark ? Material.Shade800 : Material.Shade300) |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 12 | height: 2 |
| 13 | Layout.fillWidth: true |
swissChili | e386bc7 | 2022-02-24 21:31:31 -0800 | [diff] [blame] | 14 | Layout.topMargin: 16 |
| 15 | Layout.bottomMargin: 16 |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 16 | |
| 17 | transitions: Transition { |
| 18 | NumberAnimation { |
| 19 | property: "opacity" |
| 20 | duration: 100 |
| 21 | easing.type: Easing.OutCubic |
| 22 | } |
| 23 | } |
| 24 | |
swissChili | e386bc7 | 2022-02-24 21:31:31 -0800 | [diff] [blame] | 25 | states: [ |
| 26 | State { |
| 27 | when: mouseArea.containsMouse || addButton.hovered |
| 28 | PropertyChanges { |
| 29 | target: root |
| 30 | opacity: 1 |
| 31 | } |
| 32 | }, |
| 33 | State { |
| 34 | when: !mouseArea.containsMouse && !addButton.hovered |
| 35 | PropertyChanges { |
| 36 | target: root |
| 37 | opacity: 0 |
| 38 | } |
| 39 | } |
| 40 | ] |
| 41 | |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 42 | MouseArea { |
| 43 | id: mouseArea |
| 44 | height: 30 |
| 45 | width: parent.width |
| 46 | anchors.centerIn: parent |
| 47 | hoverEnabled: true |
| 48 | |
swissChili | e386bc7 | 2022-02-24 21:31:31 -0800 | [diff] [blame] | 49 | propagateComposedEvents: true |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | Item { |
| 53 | id: insertRow |
| 54 | anchors.centerIn: parent |
| 55 | height: 24 |
| 56 | width: 24 |
| 57 | |
swissChili | 25620b0 | 2022-02-23 17:15:16 -0800 | [diff] [blame] | 58 | RoundButton { |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 59 | id: addButton |
| 60 | anchors.centerIn: parent |
| 61 | icon.source: "qrc:///icons/add.svg" |
swissChili | 06cec4e | 2022-02-24 19:04:32 -0800 | [diff] [blame] | 62 | icon.color: Constants.buttonGrey |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 63 | flat: true |
swissChili | 25620b0 | 2022-02-23 17:15:16 -0800 | [diff] [blame] | 64 | |
| 65 | onClicked: root.insertClicked() |
swissChili | e386bc7 | 2022-02-24 21:31:31 -0800 | [diff] [blame] | 66 | |
| 67 | hoverEnabled: true |
swissChili | 23958ca | 2022-02-21 19:23:34 -0800 | [diff] [blame] | 68 | } |
| 69 | } |
| 70 | } |