Warning, /education/kstars/kstars/kstarslite/qml/modules/helpers/TopMenuButton.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com> 0002 // SPDX-License-Identifier: GPL-2.0-or-later 0003 0004 import QtQuick 2.6 0005 import QtQuick.Controls 2.0 0006 import QtGraphicalEffects 1.0 0007 import "../../constants/" 1.0 0008 0009 AbstractButton { 0010 id: button 0011 property string iconSrc: "" 0012 width: icon.width + 5 0013 height: icon.height + 5 0014 property bool toggled: false 0015 opacity: toggled ? 1 : 0.3 0016 0017 property string title: " " 0018 property bool titlePlural: true 0019 0020 onClicked: { 0021 toggled = !toggled 0022 } 0023 0024 onToggledChanged: { 0025 if(isLoaded) { //Disable while loading 0026 if(toggled) { 0027 if(titlePlural) { 0028 skyMapLite.notification.showNotification(xi18n("%1 are toggled on", title)) 0029 } else { 0030 skyMapLite.notification.showNotification(xi18n("%1 is toggled on", title)) 0031 } 0032 } else { 0033 if(titlePlural) { 0034 skyMapLite.notification.showNotification(xi18n("%1 are toggled off", title)) 0035 } else { 0036 skyMapLite.notification.showNotification(xi18n("%1 is toggled off", title)) 0037 } 0038 } 0039 } 0040 } 0041 0042 DropShadow { 0043 anchors.fill: iconRect 0044 radius: 8.0 0045 samples: 16 0046 horizontalOffset: 0 0047 verticalOffset: 0 0048 color: "#000000" 0049 source: iconRect 0050 opacity: pressed ? 1 : 0 0051 0052 Behavior on opacity { 0053 OpacityAnimator { duration: 100 } 0054 } 0055 } 0056 0057 Image { 0058 id: icon 0059 source: iconSrc 0060 width: sourceSize.width/Num.pixelRatio //FIX /Num.pixelRatio we don't need it here! 0061 height: sourceSize.height/Num.pixelRatio 0062 anchors.centerIn: iconRect 0063 } 0064 0065 background: Rectangle { 0066 id: iconRect 0067 radius: 5 0068 anchors { 0069 fill: parent 0070 } 0071 color: "black" 0072 border { 0073 color: toggled ? Num.sysPalette.highlight : "grey" 0074 width: 1 0075 } 0076 } 0077 0078 onDownChanged: { 0079 /*if(down) opacity = 0.6 0080 else opacity = 1*/ 0081 } 0082 0083 onPressed: { 0084 //opacity = 0.6 0085 } 0086 0087 onReleased: { 0088 //opacity = 1 0089 } 0090 0091 Behavior on opacity { 0092 OpacityAnimator { duration: 100 } 0093 } 0094 }