Warning, /plasma/libplasma/examples/applets/testcomponents/contents/ui/MousePage.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2013 Sebastian Kügler <sebas@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 import QtQuick
0008 
0009 import org.kde.plasma.components as PlasmaComponents
0010 import org.kde.plasma.extras as PlasmaExtras
0011 import org.kde.kquickcontrolsaddons as KQuickControlsAddons
0012 import org.kde.kirigami as Kirigami
0013 
0014 // MousePage
0015 
0016 PlasmaComponents.Page {
0017     id: mousePage
0018     anchors {
0019         fill: parent
0020         margins: _s
0021     }
0022     Kirigami.Heading {
0023         id: mellabel
0024         level: 1
0025         text: "MouseEventListener"
0026         anchors { left: parent.left; right: parent.right; top: parent.top }
0027     }
0028     KQuickControlsAddons.MouseEventListener {
0029         id: mel
0030         hoverEnabled: true
0031         anchors { left: parent.left; right: parent.right; top: mellabel.bottom; bottom: parent.bottom; }
0032         /*
0033         void pressed(KDeclarativeMouseEvent *mouse);
0034         void positionChanged(KDeclarativeMouseEvent *mouse);
0035         void released(KDeclarativeMouseEvent *mouse);
0036         void clicked(KDeclarativeMouseEvent *mouse);
0037         void pressAndHold(KDeclarativeMouseEvent *mouse);
0038         void wheelMoved(KDeclarativeWheelEvent *wheel);
0039         void containsMouseChanged(bool containsMouseChanged);
0040         void hoverEnabledChanged(bool hoverEnabled);
0041         */
0042         onPressed: {
0043             print("Pressed");
0044             melstatus.text = "pressed";
0045         }
0046         onPositionChanged: {
0047             print("positionChanged: " + mouse.x + "," + mouse.y);
0048         }
0049         onReleased: {
0050             print("Released");
0051             melstatus.text = "Released";
0052         }
0053         onPressAndHold: {
0054             print("pressAndHold");
0055             melstatus.text = "pressAndHold";
0056         }
0057         onClicked: {
0058             print("Clicked");
0059             melstatus.text = "clicked";
0060         }
0061         onWheelMoved: {
0062             print("Wheel: " + wheel.delta);
0063         }
0064         onContainsMouseChanged: {
0065             print("Contains mouse: " + containsMouse);
0066         }
0067 
0068         MouseArea {
0069             //target: mel
0070             anchors.fill: parent
0071             onPressed: PlasmaExtras.DisappearAnimation { targetItem: bgImage }
0072             onReleased: PlasmaExtras.AppearAnimation { targetItem: bgImage }
0073         }
0074         Image {
0075             id: bgImage
0076             source: "image://appbackgrounds/standard"
0077             fillMode: Image.Tile
0078             anchors.fill: parent
0079             asynchronous: true
0080 //                 opacity: mel.containsMouse ? 1 : 0.2
0081 //                 Behavior on opacity { PropertyAnimation {} }
0082         }
0083         Column {
0084             //width: parent.width
0085             spacing: _s
0086             anchors.fill: parent
0087             PlasmaComponents.Button {
0088                 text: "Button"
0089                 iconSource: "call-start"
0090             }
0091             PlasmaComponents.ToolButton {
0092                 text: "ToolButton"
0093                 iconSource: "call-stop"
0094             }
0095             PlasmaComponents.RadioButton {
0096                 text: "RadioButton"
0097                 //iconSource: "call-stop"
0098             }
0099             PlasmaComponents.Label {
0100                 id: melstatus
0101             }
0102         }
0103 
0104     }
0105 }
0106