Skip to content
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

Mouse cursor on link hover #623

Closed
donjan opened this issue Jun 4, 2023 · 1 comment · Fixed by #640
Closed

Mouse cursor on link hover #623

donjan opened this issue Jun 4, 2023 · 1 comment · Fixed by #640

Comments

@donjan
Copy link
Contributor

donjan commented Jun 4, 2023

Using ReText 8.0.1 on Ubuntu 22.04.

Enabled the WebEngine renderer option (had to pip install PyQt6-WebEngine).
With live preview on.

Observed behaviour

When hovering over a link, the mouse cursor stays arrow shaped.
Screenshot from 2023-06-05 00-22-29

Expected behaviour

The mouse cursor should change into a hand with pointed index finger, as it does in ReText 7.x and in web browsers.
Screenshot from 2023-06-05 00-24-58

@donjan
Copy link
Contributor Author

donjan commented Apr 9, 2024

This could be done in webenginepreview.py by adding QCursor to the from PyQt6.QtGui import line and defining the two cursors:

hand_cursor = QCursor(Qt.CursorShape.PointingHandCursor)
arrow_cursor = QCursor(Qt.CursorShape.ArrowCursor)

Then in webenginepreview.py::ReTextWebEnginePreview, once we have the webPage object, hook into it with

webPage.linkHovered.connect(lambda value: self.setCursor(hand_cursor if value else arrow_cursor))

Works for me:
Screenshot from 2024-04-10 00-05-48

MR upcoming, I'll try to use camel case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant