Unsolved Not work when Flow and MouseArea in a ScrollView
-
no MouseArea:
import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.0 Window { id: root width: 640 height: 480 visible: true title: qsTr("Hello World") ScrollView{ anchors.fill: parent Flow{ width: parent.width Rectangle{ width: 300 height: 300 color: "red" } Rectangle{ width: 300 height: 300 color: "blue" } Rectangle{ width: 300 height: 300 color: "pink" MouseArea{ anchors.fill: parent onClicked:{ parent.color = Qt.rgba(Math.random(), Math.random(), Math.random()) } } } } } }
Add a MouseArea:
import QtQuick 2.12 import QtQuick.Window 2.12 import QtQuick.Controls 2.0 Window { id: root width: 640 height: 480 visible: true title: qsTr("Hello World") ScrollView{ anchors.fill: parent MouseArea{ anchors.fill: parent onClicked: { root.color = Qt.rgba(Math.random(), Math.random(), Math.random()) } } Flow{ width: parent.width Rectangle{ width: 300 height: 300 color: "red" } Rectangle{ width: 300 height: 300 color: "blue" } Rectangle{ width: 300 height: 300 color: "pink" MouseArea{ anchors.fill: parent onClicked:{ parent.color = Qt.rgba(Math.random(), Math.random(), Math.random()) } } } } } }
How do I let ScrollView accept mouse events?