This commit is contained in:
admin
2026-05-24 10:53:42 +00:00
parent ed74e97693
commit 34db86fdac
3 changed files with 29 additions and 10 deletions

BIN
ui/app.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

View File

@@ -1,10 +1,19 @@
# v3.0.0 editor.py
# v4.1.0 editor-link-click-fix-v1
import re
import webbrowser
from PyQt6.QtCore import Qt, QUrl
from PyQt6.QtGui import QDesktopServices
from PyQt6.QtWidgets import QTextEdit
from PyQt6.QtCore import (
Qt,
QUrl,
)
from PyQt6.QtGui import (
QDesktopServices,
)
from PyQt6.QtWidgets import (
QTextEdit,
)
URL_PATTERN = re.compile(
@@ -15,9 +24,14 @@ URL_PATTERN = re.compile(
class LinkTextEdit(QTextEdit):
def mouseReleaseEvent(self, event) -> None:
def mouseReleaseEvent(
self,
event,
) -> None:
if (
event.modifiers()
event.button()
== Qt.MouseButton.LeftButton
and event.modifiers()
& Qt.KeyboardModifier.ControlModifier
):
cursor = self.cursorForPosition(
@@ -47,14 +61,19 @@ class LinkTextEdit(QTextEdit):
)
try:
webbrowser.open(target)
webbrowser.open(
target
)
except Exception:
QDesktopServices.openUrl(
QUrl(target)
)
event.accept()
return
super().mouseReleaseEvent(event)
super().mouseReleaseEvent(
event
)

View File

@@ -28,7 +28,7 @@ def build_stylesheet(
QWidget#container {{
background: {background};
border: 1px solid {border};
border-radius: 16px;
border-radius: 7px;
}}
QWidget#container:hover {{