This commit is contained in:
恍兮惚兮 2024-06-19 10:05:42 +08:00
parent 253faf5ce5
commit 52396b957b
4 changed files with 13 additions and 10 deletions

View File

@ -6,7 +6,7 @@ import importlib
class Textbrowser(QLabel): class Textbrowser(QLabel):
contentsChanged = pyqtSignal(QSize) contentsChanged = pyqtSignal(QSize)
_padding = 10 _padding = 5
def __makeborder(self, size: QSize): def __makeborder(self, size: QSize):
_padding = self._padding _padding = self._padding

View File

@ -151,7 +151,7 @@ class QUnFrameWindow(resizableframeless):
clear = kwargs.get("clear", True) clear = kwargs.get("clear", True)
origin = kwargs.get("origin", True) origin = kwargs.get("origin", True)
text = kwargs.get("text", None) text = kwargs.get("text", None)
color = kwargs.get("color", 'black') color = kwargs.get("color", "black")
isshowrawtext = kwargs.get("isshowrawtext", False) isshowrawtext = kwargs.get("isshowrawtext", False)
iter_context = kwargs.get("iter_context", None) iter_context = kwargs.get("iter_context", None)
@ -222,15 +222,13 @@ class QUnFrameWindow(resizableframeless):
if flag: if flag:
self.show_() self.show_()
self.enterfunction()
else: else:
self.hide_() self.hide_()
def leftclicktray(self, reason): def leftclicktray(self, reason):
# 鼠标左键点击 # 鼠标左键点击
if reason == QSystemTrayIcon.Trigger: if reason == QSystemTrayIcon.Trigger:
self.show_() self.showhideui()
self.enterfunction()
def refreshtoolicon(self): def refreshtoolicon(self):
iconstate = { iconstate = {
@ -589,6 +587,10 @@ class QUnFrameWindow(resizableframeless):
self.addbuttons() self.addbuttons()
self.translate_text = Textbrowser(self) self.translate_text = Textbrowser(self)
self.translate_text.contentsChanged.connect(self.textAreaChanged) self.translate_text.contentsChanged.connect(self.textAreaChanged)
t = QTimer(self)
t.setInterval(100)
t.timeout.connect(self.__betterenterevent)
t.start()
def createborderradiusstring(self, r, merge, top=False): def createborderradiusstring(self, r, merge, top=False):
if merge: if merge:
@ -865,14 +867,15 @@ class QUnFrameWindow(resizableframeless):
self._TitleLabel.hide() self._TitleLabel.hide()
self.set_color_transparency() self.set_color_transparency()
def enterEvent(self, QEvent): def __betterenterevent(self):
if self.geometry().contains(QCursor.pos()):
self.enterfunction() self.enterfunction()
@threader @threader
def dodelayhide(self, delay): def dodelayhide(self, delay):
enter_sig = time.time() enter_sig = time.time()
self.enter_sig = enter_sig self.enter_sig = enter_sig
while self.underMouse(): while self.geometry().contains(QCursor.pos()):
time.sleep(0.1) time.sleep(0.1)
time.sleep(delay) time.sleep(delay)
if self.enter_sig != enter_sig: if self.enter_sig != enter_sig:

View File

@ -92,7 +92,7 @@ class TextBrowser(QWidget, dataget):
def calllunaheightchange(self, h): def calllunaheightchange(self, h):
self.contentsChanged.emit( self.contentsChanged.emit(
QSize(self.width(), h * self.webivewwidget.get_ZoomFactor()) QSize(self.width(), int(h * self.webivewwidget.get_ZoomFactor()))
) )
def internalheighchange(self): def internalheighchange(self):

View File

@ -29,7 +29,7 @@ include(generate_product_version)
set(VERSION_MAJOR 5) set(VERSION_MAJOR 5)
set(VERSION_MINOR 0) set(VERSION_MINOR 0)
set(VERSION_PATCH 0) set(VERSION_PATCH 1)
add_library(pch pch.cpp) add_library(pch pch.cpp)
target_precompile_headers(pch PUBLIC pch.h) target_precompile_headers(pch PUBLIC pch.h)