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

Change mouse cursor to pointing hand on link hover (#623) #640

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ReText/webenginepreview.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from ReText.editor import getColor
from ReText.syncscroll import SyncScroll
from PyQt6.QtCore import QEvent, Qt
from PyQt6.QtGui import QDesktopServices, QFontInfo, QGuiApplication, QTextDocument, QColor
from PyQt6.QtGui import QCursor, QDesktopServices, QFontInfo, QGuiApplication, QTextDocument, QColor
from PyQt6.QtWidgets import QLabel
from PyQt6.QtWebEngineCore import (
QWebEnginePage,
Expand Down Expand Up @@ -138,6 +138,11 @@ def __init__(self, tab,

QWebEngineView.__init__(self, parent=tab)
webPage = ReTextWebEnginePage(self, tab)

handCursor = QCursor(Qt.CursorShape.PointingHandCursor)
arrowCursor = QCursor(Qt.CursorShape.ArrowCursor)
webPage.linkHovered.connect(lambda value: self.setCursor(handCursor if value else arrowCursor))

self.setPage(webPage)

self.syncscroll = SyncScroll(webPage,
Expand Down