Kstars

BottomMenuButton.qml
1// SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4import QtQuick 2.7
5import QtQuick.Controls 2.0
6import "../../constants/" 1.0
7
8AbstractButton {
9 id: button
10 property string iconSrc: ""
11 width: icon.width + 5
12 height: icon.height + 5
13
14 Image {
15 id: icon
16 source: iconSrc
17 width: sourceSize.width/Num.pixelRatio
18 height: sourceSize.height/Num.pixelRatio
19 anchors.centerIn: iconRect
20 }
21
22 background: Rectangle {
23 id: iconRect
24 radius: 5
25 anchors {
26 //centerIn: parent
27 fill: parent
28 }
29 color: "black"
30 border {
31 color: Num.sysPalette.light
32 width: 1
33 }
34 }
35
36 onDownChanged: {
37 if(down) opacity = 0.6
38 else opacity = 1
39 }
40
41 onPressed: {
42 opacity = 0.6
43 }
44
45 onReleased: {
46 opacity = 1
47 }
48
49 Behavior on opacity {
50 OpacityAnimator { duration: 100 }
51 }
52}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:03 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.