aerothemeplasma/plasma/plasmoids/io.gitgud.wackyideas.SevenStart/contents/ui/FloatingOrb.qml

89 lines
2.6 KiB
QML
Raw Permalink Normal View History

2024-08-09 01:20:25 +00:00
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Dialogs
import QtQuick.Window
import org.kde.plasma.plasmoid
import org.kde.plasma.core as PlasmaCore
import org.kde.plasma.components as PlasmaComponents
import org.kde.plasma.extras as PlasmaExtras
import org.kde.plasma.private.kicker as Kicker
import org.kde.coreaddons as KCoreAddons // kuser
import org.kde.plasma.private.shell 2.0
import org.kde.kwindowsystem 1.0
import org.kde.kquickcontrolsaddons 2.0
import org.kde.plasma.private.quicklaunch 1.0
import org.kde.kirigami 2.13 as Kirigami
import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons
import org.kde.kwindowsystem 1.0
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
import org.kde.kirigami as Kirigami
Item {
id: floatingOrb
width: buttonIconSizes.width
height: buttonIconSizes.height / 3
property alias buttonIconSizes: buttonIconSizes
property alias buttonIcon: buttonIcon
property alias buttonIconPressed: buttonIconPressed
property alias buttonIconHovered: buttonIconHovered
property alias mouseArea: mouseArea
property string orbTexture: getResolvedUrl(Plasmoid.configuration.customButtonImage, "orbs/orb.png")
property int opacityDuration: 300
Image {
id: buttonIconSizes
smooth: true
source: orbTexture
opacity: 0;
}
clip: false
Image {
id: buttonIcon
smooth: true
source: orbTexture
sourceClipRect: Qt.rect(0, 0, buttonIconSizes.width, buttonIconSizes.height / 3);
}
Image {
id: buttonIconPressed
visible: dashWindow.visible
smooth: true
source: orbTexture
verticalAlignment: Image.AlignBottom
sourceClipRect: Qt.rect(0, 2*buttonIconSizes.height / 3, buttonIconSizes.width, buttonIconSizes.height / 3);
}
Image {
id: buttonIconHovered
source: orbTexture
opacity: mouseArea.containsMouse || mouseAreaCompositingOff.containsMouse
visible: !dashWindow.visible
Behavior on opacity {
NumberAnimation { properties: "opacity"; easing.type: Easing.Linear; duration: opacityDuration }
}
verticalAlignment: Image.AlignVCenter
sourceClipRect: Qt.rect(0, buttonIconSizes.height / 3, buttonIconSizes.width, buttonIconSizes.height / 3);
}
MouseArea
{
id: mouseArea
anchors.fill: parent
hoverEnabled: true
2024-08-09 16:59:03 +00:00
acceptedButtons: Qt.LeftButton// | Qt.RightButton
//propagateComposedEvents: true
2024-08-09 01:20:25 +00:00
onPressed: mouse => {
2024-08-09 16:59:03 +00:00
//if(mouse.button === Qt.LeftButton)
2024-08-09 01:20:25 +00:00
root.showMenu();
}
}
}