There is a rectangle that changes color when you hover the mouse. On the rectangle there is a button with a menu. After a few clicks on the menu items, the rectangle stops changing color when you hover the mouse.
import QtQuick 2.0 import QtQml 2.2 import QtQuick.Layouts 1.1 import QtQuick.Controls 1.1 import QtQuick.Window 2.2 import QtQuick.Controls.Styles 1.4 Window { visible: true Rectangle { id: rect anchors.fill: parent color: "grey" MouseArea { id: area hoverEnabled: true anchors.fill: parent onEntered: { rect.color = "white" } onExited: { rect.color = "grey" } } Button { text: "Button1" menu: Menu { MenuItem { text: "Cut" } MenuItem { text: "Copy" } } } } }