spix icon indicating copy to clipboard operation
spix copied to clipboard

Clicks on invisible objects

Open ctmbl opened this issue 3 years ago • 1 comments

Hi @faaxm In my Qt app I currently have buttons in a rowLayout, I use Spix in remote control with AnyRPC to control them and it works amazingly !

However, if one of these buttons turns invisible (button01), with its Qt-QML property visible: false, the layout automatically rearrange the other buttons (button00 and button02) putting them over the invisible button (button01). Then if I use another s.mouseClick("mainWindow/button01") Spix find well my button because it still exists, gets its bounding box and clicks there. Problem is it's invisible and button02 has overdisplay it, so button02 is triggered because there is no checks on the visible property before the click.

Of course it's easy to patch on the client side by checking with s.existsAndVisible("mainWindow/button01") but would it be convenient to add an anyRPC method in order to do that, for example a mouseClickWithCheck, or simply to have a ClickOnItem: [WARNING] item clicked but invisible like the Item not found report error in ClickOnItem::execute

I could propose such an implementation if you're interested in. Thanks a lot 😉

ctmbl avatar Apr 20 '22 15:04 ctmbl

Hi @ctmbl

I think I am not quite convinced by this proposal, as I prefer the "spix" side to be rather lightweight. One reason is, that it is hard for Spix to tell which action users would expect from a mouseClickWithCheck. For a unit test it might be important to fail immediately, in other cases the warning like you propose might be better. Due to that, i think it is better if the client handles this as the client knows best what to do, if an item is not actually there. To make this more user friendly, you could define a helper function in python that does exactly what you want, and then reuse that. I could also see that it might be nice to have a python library with a collection of such helper functions available.

Another point that could cause confusion is that the Visible check itself might actually not always be what people expect. E.g. if a item is "visible" but covered by another object in front of it, Spix would still click on the item in front of it... For this a more sophisticated check would be nice that could verify if an item actually can be seen on screen...

faaxm avatar Apr 22 '22 21:04 faaxm