PDA

View Full Version : Emit mouse signals on parent item



sz
10th May 2016, 14:33
Hi all.
I want to encapsulate a MouseArea with an item that adds some additional logic and, expose the same signals (with the same parameters).
I tried to expose the "pressed" and "released" signals as follows (with a parameter of MouseEvent (http://doc.qt.io/qt-4.8/qml-mouseevent.html) type, as the original signals (http://doc.qt.io/qt-4.8/qml-mousearea.html#onPressed-signal)):

import QtQuick 2.0

Item {
signal pressed(MouseEvent mouse)
signal released(MouseEvent mouse)

MouseArea
{
anchors.fill: parent

onPressed: parent.pressed(mouse)
onReleased: parent.released(mouse)
}
}

But, it seems like it doesn't recognize the MouseEvent type.
What do I do wrong? Is there a way to declare variables with the MouseEvent type?