QML MouseArea - Mouse Is Not Defined
-
I'm working with QML for the first time in a long time and I noticed something while working with MouseAreas... I need to make it propagate through the MouseArea and eventually trigger a ComboBox to open up. I do this by using mouse.accepted = false on the MouseArea event that I catch (onPressed).
This worked perfectly fine when running the program with the Qt Debugger, but when running without the Debugger (even when running the standalone application, running the application as admin, and running the creator as admin), I get the following error. Note this happens even with other MouseArea events (such as onClicked).
ReferenceError: mouse is not defined
Is this a bug or am I doing something wrong here...? I am using Qt 5.15 and creator 4.15.0 (https://puu.sh/IGdRy/c8760bf2d8.png)
I was able to reproduce the issue with VERY minimal code...
import QtQuick 2.15 import QtQuick.Window 2.15 import QtQuick.Controls 2.12 import QtQuick.Layouts 1.12 Window { width: 640 height: 480 visible: true MouseArea { anchors.fill: parent propagateComposedEvents: true onPressed: function () { mouse.accepted = false console.log("Hit, but mouse doesn't exist?"); } } }
The issue is pretty self explanatory, but here's a short clip of the issue happening.
[https://puu.sh/IGdXd/66252c6d30.mp4](link url) -
MouseArea { anchors.fill: parent propagateComposedEvents: true onPressed: { mouse.accepted = false console.log("Hit, but mouse doesn't exist?"); } }
You don't need "function()". If for some reason you want function it should accept a parameter: function(mouse). However, I don't even know if that would work.