import QtQuick 2.7 Rectangle { width: 100 height: 100 color: ma.pressed ? "blue" : "green" MouseArea { id: ma anchors.fill: parent } }