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 re
import webbrowser import webbrowser
from PyQt6.QtCore import Qt, QUrl from PyQt6.QtCore import (
from PyQt6.QtGui import QDesktopServices Qt,
from PyQt6.QtWidgets import QTextEdit QUrl,
)
from PyQt6.QtGui import (
QDesktopServices,
)
from PyQt6.QtWidgets import (
QTextEdit,
)
URL_PATTERN = re.compile( URL_PATTERN = re.compile(
@@ -15,9 +24,14 @@ URL_PATTERN = re.compile(
class LinkTextEdit(QTextEdit): class LinkTextEdit(QTextEdit):
def mouseReleaseEvent(self, event) -> None: def mouseReleaseEvent(
self,
event,
) -> None:
if ( if (
event.modifiers() event.button()
== Qt.MouseButton.LeftButton
and event.modifiers()
& Qt.KeyboardModifier.ControlModifier & Qt.KeyboardModifier.ControlModifier
): ):
cursor = self.cursorForPosition( cursor = self.cursorForPosition(
@@ -47,14 +61,19 @@ class LinkTextEdit(QTextEdit):
) )
try: try:
webbrowser.open(target) webbrowser.open(
target
)
except Exception: except Exception:
QDesktopServices.openUrl( QDesktopServices.openUrl(
QUrl(target) QUrl(target)
) )
event.accept()
return return
super().mouseReleaseEvent(event) super().mouseReleaseEvent(
event
)

View File

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