Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to hide toolTips when component is hidden?



  • I've got a view structure that looks like this:

    Rectangle A
    ->Rectangle B
    -->Button with tooltip
    Text

    Either Rectangle A is showing, or Text is showing, but not both. I flip back and forth by changing the opacities.

    The problem is that the tooltip for the Button shows up even when Rectangle A has an opacity of 0. I can write code to avoid showing the tooltip in the Rectangle B qml code, but I can't access the opacity of Rectangle A from the Button's code (the two rectangles are in different qml files), and opacity isn't inherited (setting the opacity of Rectangle A has no effect on the opacity of Rectangle B or Button)

    What's the best way to avoid showing the Button's tooltip?



  • I found the solution.

    I needed to change the visibility of Rectangle A to be opacity > 0, and then I could test visibility in subviews.


Log in to reply