Here's a code snippet with current form of the code
Rectangle
{
id: menu
GridLayout
{
id: layout
columns: 4
rows: 3
Repeater
{
model: ListModel {}
ToolButton {}
}
Rectangle
{
x: -3
y: -33
width: menu.width - 2
height: menu.height + 33
border.color: "red"
border.width: 3
color: "blue"
MouseArea
{
x: mapToItem(menu, -5, -35).x
y: mapToItem(menu, -5, -35).y
width: menu.width
height: menu.height + 35
hoverEnabled: true
preventStealing: true
onEntered:console.log("onEntered")
onExited:console.log("onExited menu mous area")
}
}
}
}
The MouseArea
hover event is propagated down to the ToolButtons
in the layout
. I don't get why. Hence, the onEntered
and onExited
events do not work as expected, because onExited
happen inside the MouseArea
when the ToolButtons
are 'hovered' and tooltips are shown. In the end I need the MouseArea
to be a bit wider and longer than its parent Rectangle
so that once onExited
is emitted the menu
gets invisible. After the test with Rectangle
is successfull it will make sense to make C++ type Polygon.