MouseArea clicked and pressed does not get emited



  • This is my mouse area code :
    @MouseArea {
    id: toolbarMouseArea
    width: toolbar.width; x : 0
    height: toolbar.height; y : 0

        hoverEnabled: true
        onEntered:
        {
            toolbar.state = "visible";
        }
        onExited:
        {
            if(autoHides) toolbar.state = "hidden";
            else toolbar.state = "visible";
        }
        onPressed: console.log("pressed")
        onClicked: console.log("clicked")
    }@
    

    My problem is that clicked and pressed signals do not get emited when I click on the toolbar surface
    This does not work neither with auto hidden toolbar or always visible.
    Please help.



  • use @anchors.fill : parent@



  • @Neutron Stein,
    that did not change anything
    Cliks are still not registered.



  • There seems to be a problem with some other parts of my code.
    The mouse area works when that gets commented out.



  • The full code please



  • It can be due to focus handling. If something else above the MouseArea accepts certain user-input events, then they will not be delivered to the MouseArea underneath. It can also be due to the "inherited enable" property - if a child of an Item accepts input events, but the parent item has the enabled property set to false, no events will be handled by the parent item or any of its children. I believe.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.