This commit is contained in:
恍兮惚兮 2024-09-14 19:55:45 +08:00
parent 5d93f01149
commit 4772048f51
2 changed files with 31 additions and 14 deletions

View File

@ -465,9 +465,9 @@ class TextBrowser(QWidget, dataget):
def _showyinyingtext2(self, color, iter_context_class, pos, text, font): def _showyinyingtext2(self, color, iter_context_class, pos, text, font):
if iter_context_class not in self.iteryinyinglabelsave: if iter_context_class not in self.iteryinyinglabelsave:
self.iteryinyinglabelsave[iter_context_class] = [] self.iteryinyinglabelsave[iter_context_class] = []
for label in self.iteryinyinglabelsave[iter_context_class]: for label in self.iteryinyinglabelsave[iter_context_class]:
label.hide() label.hide()
maxh = self.maxvisheight maxh = self.maxvisheight
subtext = [] subtext = []
subpos = [] subpos = []
@ -486,20 +486,37 @@ class TextBrowser(QWidget, dataget):
if text[i] != "\n": if text[i] != "\n":
subtext[-1] += text[i] subtext[-1] += text[i]
used = set()
collects = [] collects = []
for i in range(len(subtext)): for i in range(len(subtext)):
if i >= len(self.iteryinyinglabelsave[iter_context_class]):
self.iteryinyinglabelsave[iter_context_class].append( finded = -1
self.currentclass(self.toplabel2) for j in range(len(self.iteryinyinglabelsave[iter_context_class])):
) if j in used:
_ = self.iteryinyinglabelsave[iter_context_class][i] continue
_.setColor(color) if (
_.setText(subtext[i]) self.iteryinyinglabelsave[iter_context_class][j].text()
_.setFont(font) == subtext[i]
_.adjustSize() ):
_.move(subpos[i].x(), subpos[i].y() + self.labeloffset_y) finded = j
_.show() used.add(j)
break
if finded >= 0:
_ = self.iteryinyinglabelsave[iter_context_class][finded]
_.move(subpos[i].x(), subpos[i].y() + self.labeloffset_y)
_.show()
else:
if i >= len(self.iteryinyinglabelsave[iter_context_class]):
self.iteryinyinglabelsave[iter_context_class].append(
self.currentclass(self.toplabel2)
)
_ = self.iteryinyinglabelsave[iter_context_class][i]
_.setColor(color)
_.setText(subtext[i])
_.setFont(font)
_.adjustSize()
_.move(subpos[i].x(), subpos[i].y() + self.labeloffset_y)
_.show()
self.textcursor.setPosition(pos) self.textcursor.setPosition(pos)
self.textbrowser.setTextCursor(self.textcursor) self.textbrowser.setTextCursor(self.textcursor)
tl1 = self.textbrowser.cursorRect(self.textcursor).topLeft() tl1 = self.textbrowser.cursorRect(self.textcursor).topLeft()

View File

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