Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I pass a MouseEvent parameter in a QML signal

Tags:

qt

qml

I'm trying to propagate the MouseArea signals to a parent object, but using MouseEvent as the parameter type causes an import error.

import QtQuick 2.0
import org.kde.plasma.core 2.0

Rectangle {
    id: linkRect

    signal clicked(MouseEvent mouse)

    ToolTipArea {
        id: tooltip
        anchors.fill: parent

        MouseArea {
            id: mouseArea
            anchors.fill: parent

            onClicked: linkRect.clicked(mouse)
        }
    }
}
like image 770
Zren Avatar asked Sep 25 '16 18:09

Zren


1 Answers

Use the var type like this:

signal clicked(var mouse)
like image 106
Zren Avatar answered Nov 15 '22 05:11

Zren