From 51e8511275ad39c5ad54c33bdb77f1a9a2bd50c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Fri, 15 Feb 2013 01:40:33 +0100 Subject: [PATCH] Add a test page for MouseEventListener --- .../contents/ui/testcomponents.qml | 73 ++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/applets/testcomponentsapplet/contents/ui/testcomponents.qml b/applets/testcomponentsapplet/contents/ui/testcomponents.qml index 8b22dd937..a45636ceb 100644 --- a/applets/testcomponentsapplet/contents/ui/testcomponents.qml +++ b/applets/testcomponentsapplet/contents/ui/testcomponents.qml @@ -40,9 +40,10 @@ Item { } height: _h - currentTab: pageOne + currentTab: melPage PlasmaComponents.TabButton { tab: pageOne; text: "Icons & Buttons"; iconSource: "edit-image-face-show"} PlasmaComponents.TabButton { tab: pageTwo; text: "Plasmoid"; iconSource: "basket"} + PlasmaComponents.TabButton { tab: melPage; text: "MouseEventListener"; iconSource: "preferences-desktop-mouse"} } PlasmaComponents.TabGroup { @@ -166,6 +167,76 @@ Item { } } } + + PlasmaComponents.Page { + id: melPage + PlasmaComponents.Label { + id: mellabel + text: "MouseEventListener" + anchors { left: parent.left; right: parent.right; top: parent.top } + } + QtExtras.MouseEventListener { + hoverEnabled: true + anchors { left: parent.left; right: parent.right; top: mellabel.bottom; bottom: parent.bottom; } + /* + void pressed(KDeclarativeMouseEvent *mouse); + void positionChanged(KDeclarativeMouseEvent *mouse); + void released(KDeclarativeMouseEvent *mouse); + void clicked(KDeclarativeMouseEvent *mouse); + void pressAndHold(KDeclarativeMouseEvent *mouse); + void wheelMoved(KDeclarativeWheelEvent *wheel); + void containsMouseChanged(bool containsMouseChanged); + void hoverEnabledChanged(bool hoverEnabled); + */ + onPressed: { + melstatus.text = "pressed"; + } + onPositionChanged: { + print("positionChanged: " + mouse.x + "," + mouse.y); + } + onReleased: { + print("Released"); + melstatus.text = "Released"; + } + onPressAndHold: { + print("pressAndHold"); + melstatus.text = "pressAndHold"; + } + onClicked: { + print("Clicked"); + melstatus.text = "clicked"; + } + onWheelMoved: { + print("Wheel: " + wheel.delta); + } + onContainsMouseChanged: { + print("Contains mouse: " + containsMouse); + } + + Column { + //width: parent.width + spacing: _s + anchors.fill: parent + PlasmaComponents.Button { + text: "Button" + iconSource: "call-start" + } + PlasmaComponents.ToolButton { + text: "ToolButton" + iconSource: "call-stop" + } + PlasmaComponents.RadioButton { + text: "RadioButton" + //iconSource: "call-stop" + } + PlasmaComponents.Label { + id: melstatus + } + } + + } + } + } Component.onCompleted: {