mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-27 15:44:12 +08:00
fix
This commit is contained in:
parent
4d70fff72b
commit
6c2913fe47
@ -275,8 +275,10 @@ class TextBrowser(QWidget, dataget):
|
||||
textlines, linetags = self._splitlinestags(font, tag, text)
|
||||
text = "\n".join(textlines)
|
||||
tag = self._join_tags(linetags, True)
|
||||
tag = tag if isshowhira else []
|
||||
self._textbrowser_append(origin, atcenter, text, tag, color)
|
||||
tagshow = tag if isshowhira else []
|
||||
else:
|
||||
tagshow = []
|
||||
self._textbrowser_append(origin, atcenter, text, tagshow, color)
|
||||
if len(tag) and (isshow_fenci or isfenciclick):
|
||||
self.addsearchwordmask(isshow_fenci, isfenciclick, tag)
|
||||
|
||||
@ -466,7 +468,7 @@ class TextBrowser(QWidget, dataget):
|
||||
|
||||
for label in self.iteryinyinglabelsave[iter_context_class]:
|
||||
label.hide()
|
||||
|
||||
maxh = self.maxvisheight
|
||||
subtext = []
|
||||
subpos = []
|
||||
lastpos = None
|
||||
@ -475,6 +477,8 @@ class TextBrowser(QWidget, dataget):
|
||||
self.textcursor.setPosition(posx)
|
||||
posx += 1
|
||||
tl1 = self.textbrowser.cursorRect(self.textcursor).topLeft()
|
||||
if tl1.y() > maxh:
|
||||
break
|
||||
if lastpos is None or tl1.y() != lastpos.y():
|
||||
lastpos = tl1
|
||||
subpos.append(lastpos)
|
||||
@ -534,15 +538,21 @@ class TextBrowser(QWidget, dataget):
|
||||
self.textcursor.setPosition(blockstart + s)
|
||||
self.textbrowser.setTextCursor(self.textcursor)
|
||||
tl1 = self.textbrowser.cursorRect(self.textcursor).topLeft()
|
||||
if tl1.y() > maxh:
|
||||
return
|
||||
collects[collecti].move(tl1.x(), tl1.y() + self.labeloffset_y)
|
||||
collecti += 1
|
||||
|
||||
@property
|
||||
def maxvisheight(self):
|
||||
return QApplication.primaryScreen().virtualGeometry().height() * 2
|
||||
|
||||
def _showyinyingtext(self, b1, b2, color, font):
|
||||
linei = self.yinyingposline
|
||||
|
||||
doc = self.textbrowser.document()
|
||||
block = doc.findBlockByNumber(0)
|
||||
|
||||
maxh = self.maxvisheight
|
||||
for blocki in range(b1, b2):
|
||||
block = doc.findBlockByNumber(blocki)
|
||||
layout = block.layout()
|
||||
@ -558,18 +568,20 @@ class TextBrowser(QWidget, dataget):
|
||||
self.textcursor.setPosition(blockstart + s)
|
||||
self.textbrowser.setTextCursor(self.textcursor)
|
||||
tl1 = self.textbrowser.cursorRect(self.textcursor).topLeft()
|
||||
|
||||
if tl1.y() > maxh:
|
||||
self.yinyingposline = linei
|
||||
return
|
||||
if self.yinyinglabels_idx >= len(self.yinyinglabels):
|
||||
self.yinyinglabels.append(self.currentclass(self.toplabel2))
|
||||
_ = self.yinyinglabels[self.yinyinglabels_idx]
|
||||
self.yinyinglabels_idx += 1
|
||||
|
||||
_.setColor(color)
|
||||
_.setText(block.text()[s : s + l])
|
||||
_.setFont(font)
|
||||
_.adjustSize()
|
||||
_.move(tl1.x(), tl1.y() + self.labeloffset_y)
|
||||
_.show()
|
||||
|
||||
linei += 1
|
||||
self.yinyingposline = linei
|
||||
|
||||
@ -663,6 +675,7 @@ class TextBrowser(QWidget, dataget):
|
||||
self.settextposcursor(pos)
|
||||
savetaglabels_idx = 0
|
||||
lines = [[]]
|
||||
maxh = self.maxvisheight
|
||||
for word in x:
|
||||
l = len(word["orig_X"])
|
||||
tl1 = self.textbrowser.cursorRect(self.textcursor).topLeft()
|
||||
@ -672,6 +685,8 @@ class TextBrowser(QWidget, dataget):
|
||||
if not self._checkwordhastag(word):
|
||||
continue
|
||||
tl2 = self.textbrowser.cursorRect(self.textcursor).topLeft()
|
||||
if tl2.y() > maxh:
|
||||
break
|
||||
_ = self.solvejiaminglabel(
|
||||
savetaglabels_idx, word, fonthira, fontori_m, tl1, fha
|
||||
)
|
||||
|
@ -15,9 +15,6 @@ class base(QWidget):
|
||||
def extraWH(self):
|
||||
return 2 * self.config.get("width", 0), 2 * self.config.get("width", 0)
|
||||
|
||||
def init(self):
|
||||
pass
|
||||
|
||||
@property
|
||||
def config(self):
|
||||
return globalconfig["rendertext"]["textbrowser"][self.typename].get("args", {})
|
||||
@ -41,8 +38,6 @@ class base(QWidget):
|
||||
self._pix = None
|
||||
self._m_text = ""
|
||||
|
||||
self.init()
|
||||
|
||||
def adjustSize(self):
|
||||
self._pix = None
|
||||
font = self.font()
|
||||
|
@ -2009,7 +2009,7 @@
|
||||
"ZoomFactor": 1,
|
||||
"realtime_edit_target": "realtime_edit",
|
||||
"magpiepath": "",
|
||||
"movefollow": true,
|
||||
"movefollow": false,
|
||||
"focusnotop": false,
|
||||
"autostarthook": true,
|
||||
"minlength": 0,
|
||||
|
@ -29,7 +29,7 @@ include(generate_product_version)
|
||||
|
||||
set(VERSION_MAJOR 5)
|
||||
set(VERSION_MINOR 35)
|
||||
set(VERSION_PATCH 4)
|
||||
set(VERSION_PATCH 5)
|
||||
|
||||
add_library(pch pch.cpp)
|
||||
target_precompile_headers(pch PUBLIC pch.h)
|
||||
|
@ -31,8 +31,7 @@ std::optional<std::wstring> clipboard_get_internal()
|
||||
LPWSTR pszText = static_cast<LPWSTR>(GlobalLock(hData));
|
||||
if (pszText == 0)
|
||||
break;
|
||||
int sz = GlobalSize(hData);
|
||||
data = std::move(std::wstring(pszText, sz));
|
||||
data = std::move(std::wstring(pszText));
|
||||
GlobalUnlock(hData);
|
||||
} while (false);
|
||||
CloseClipboard();
|
||||
|
Loading…
x
Reference in New Issue
Block a user