Android: MouseArea.onClicked doesn't get called
-
I have the following QML file:
import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Layouts 1.3 import ReaderView 1.0 ApplicationWindow { visible: true MouseArea { anchors.fill: parent onClicked: { console.log("onClicked!") } } ColumnLayout { spacing: 0 anchors.fill: parent CReaderView { anchors.fill: parent } } }
I'm tapping the screen of the Nexus 7 tablet but
onClicked
is never printed in the log. I also tried moving theMouseArea
insideCReaderView
to no avail. What's the deal? How can I detect a tap within the window (or, ideally, within theCReaderView
)? -
I wonder if the issue is the output of console.log being filtered out through categorized logging rules. http://doc.qt.io/qt-5/qloggingcategory.html
Try setting the QT_LOGGING_RULES environment variable to "qml.debug=true".
-
I wonder if the issue is the output of console.log being filtered out through categorized logging rules. http://doc.qt.io/qt-5/qloggingcategory.html
Try setting the QT_LOGGING_RULES environment variable to "qml.debug=true".
@jeremy_k
It's Android so I have no idea how to set an environment variable. Instead, I'll just call a C++ method that will useqDebug()
.
And turns out you're right! So does it mean I cannot rely onconsole
for debug output from QML and must use my own class instead? Or can this be fixed (other than by adjusting the environment)? -
@jeremy_k
It's Android so I have no idea how to set an environment variable. Instead, I'll just call a C++ method that will useqDebug()
.
And turns out you're right! So does it mean I cannot rely onconsole
for debug output from QML and must use my own class instead? Or can this be fixed (other than by adjusting the environment)?