-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Qt6] Drawer element blocks mouseClick #54
Comments
I have had some issues with the synthetic events in more complex cases, like drag&drop, where Qt seems to work directly with system events and not with the QEvents in its own queue. But that this would be caused by just adding a What happens if you use pyAutoGUI to create the events on the system level? |
Interaction with pyAutoGui seems to work. Test script: import xmlrpc.client
import time
import pyautogui
def clickItem(path):
# from https://github.com/faaxm/spix/blob/master/examples/RemoteCtrl/script/autogui.py
# Query spix to get the location of the item
bounds = s.getBoundingBox(path)
# bounds = [x, y, width, height] as list
center_x = bounds[0] + bounds[2] / 2
center_y = bounds[1] + bounds[3] / 2
# use pyautogui to move the cursor...
pyautogui.moveTo(center_x, center_y, duration=1)
# ...and click
pyautogui.click()
s = xmlrpc.client.ServerProxy('http://localhost:9000')
print('Test synthetic click')
time.sleep(1)
s.mouseClick("window/clickMe")
print(s.getErrors())
time.sleep(1)
print('Test autogui click')
time.sleep(1)
clickItem("window/clickMe")
print(s.getErrors())
print('done') Log without drawer: Starting minimalDrawerBug...
QML debugging is enabled. Only use this in a safe environment.
QMouseEvent(MouseButtonPress LeftButton pos=60.1016,12.5 scn=60.1016,12.5 gbl=844,1400 dev=QPointingDevice("core pointer" Mouse id=1))
QMouseEvent(MouseButtonRelease LeftButton pos=60.1016,12.5 scn=60.1016,12.5 gbl=844,1400 dev=QPointingDevice("core pointer" Mouse id=1))
qml: clicked
qml: clicked Log with drawer: Starting minimalDrawerBug...
QML debugging is enabled. Only use this in a safe environment.
QMouseEvent(MouseButtonPress LeftButton pos=60.1016,12.5 scn=60.1016,12.5 gbl=1121,1226 dev=QPointingDevice("core pointer" Mouse id=1))
QMouseEvent(MouseButtonRelease LeftButton pos=60.1016,12.5 scn=60.1016,12.5 gbl=1121,1226 dev=QPointingDevice("core pointer" Mouse id=1))
qml: clicked If you could take a look at the project that would be great, I am thoroughly stumped: minimalDrawerBug.zip. Let me know if you have any questions. |
Sorry for the long wait, I had less time to look into this than I had hoped... The output I get is:
The synthetic click also works when running the app with |
Hi there, very similar (or maybe same) problem is happening with our app, using quite complex UI elements. Spix works great with Qt 5.15.10 but all generated QEvents have no effect in Qt 6.4.2. Note that some of the constructors that Spix is using (e.g. Update: |
I've found through debugging that the issue was caused by an inactive |
Hi there, I have the same problem. My UI has a drawer on it which seems to block the mouse events. As soon as i replace the drawer everything works. Disabling, or modifying any property doensn't help to have the mouse clicks come through. I'm using Qt 6.5.0. |
I think, it is related to how mouse events are simulated. In the current SPIX version, they are fired on windows level. I have changed this to component level in my SPIX version. You can then adress the target component directly and the events are working even underneath a drawer. There is a corresponding pull request (#101), but it is still open. |
Thanks for the hint. But for me it still doesn't work. Maybe I didn't something wrong using your commit. Anyway, did you try your changes it with the example given by @prototypicalpro in the first post? |
Just tried it, and it works with my version. If I define WINDOW_MODE in QtEvents.cpp the code in the first post is not working. If I use my changes, it works as expected. Check, if you have the changes in QtEvents.cpp to switch between the old and my new mode. |
Hmm, in my case undefining WINDOW_MODE is even worse. I have the following structure: |
In a TabBar you have to give unique ids or objectNames to the TabButtons to be able to address them. Should not work properly in both event modes, I guess. |
Sorry for the confusion, the path I mentioned was just the object path. The id/objectName path is |
I have a strange bug that I'm trying to wrap my head around. When using spix (modified to print the mouse events) with a minimal QML application on Qt6 everything works as expected:
When I update the QML application to include a
Drawer
element, however, spix is unable to click on the element:I am still able to click the button with normal mouse interaction, but spix seems unable to replicate the same behavior using synthetic events. As far as I can tell spix is generating the same MouseEvent in both cases, so maybe it has something to do with how Drawer interacts with mouse events?
I'm on Ubuntu 20.04, Qt 6.2.3 and the latest spix from
master
(modified slightly to print mouse events). I'd be happy to post the full project that I test with if that's helpful.The text was updated successfully, but these errors were encountered: