| 1 |
/* |
| 2 |
* Copyright (C) 2025 UBports Foundation |
| 3 |
* |
| 4 |
* This program is free software: you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU General Public License 3 as published by |
| 6 |
* the Free Software Foundation, either version 3 of the License, or |
| 7 |
* (at your option) any later version. |
| 8 |
* |
| 9 |
* This program is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
* GNU General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU General Public License |
| 15 |
* along with this program. If not, see http://www.gnu.org/licenses/. |
| 16 |
*/ |
| 17 |
|
| 18 |
import QtQuick 2.12 |
| 19 |
import Lomiri.Components 1.3 |
| 20 |
|
| 21 |
Rectangle { |
| 22 |
id: rootItem |
| 23 |
|
| 24 |
property Action action |
| 25 |
property bool show: false |
| 26 |
|
| 27 |
opacity: show ? 1 : 0 |
| 28 |
visible: opacity > 0 |
| 29 |
height: parent.height * 0.6 |
| 30 |
width: height |
| 31 |
radius: width / 2 |
| 32 |
color: action.enabled ? theme.palette.normal.foreground : theme.palette.disabled.foreground |
| 33 |
border { |
| 34 |
width: units.dp(1) |
| 35 |
color: action.enabled ? theme.palette.normal.activity : "transparent" |
| 36 |
} |
| 37 |
|
| 38 |
Behavior on opacity { LomiriNumberAnimation {} } |
| 39 |
|
| 40 |
Icon { |
| 41 |
anchors.centerIn: parent |
| 42 |
name: rootItem.action.iconName |
| 43 |
height: parent.height * 0.6 |
| 44 |
width: height |
| 45 |
color: rootItem.action.enabled ? theme.palette.normal.foregroundText : theme.palette.disabled.foregroundText |
| 46 |
} |
| 47 |
} |