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):
if iter_context_class not in self.iteryinyinglabelsave:
self.iteryinyinglabelsave[iter_context_class] = []
for label in self.iteryinyinglabelsave[iter_context_class]:
label.hide()
maxh = self.maxvisheight
subtext = []
subpos = []
@ -486,20 +486,37 @@ class TextBrowser(QWidget, dataget):
if text[i] != "\n":
subtext[-1] += text[i]
used = set()
collects = []
for i in range(len(subtext)):
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()
finded = -1
for j in range(len(self.iteryinyinglabelsave[iter_context_class])):
if j in used:
continue
if (
self.iteryinyinglabelsave[iter_context_class][j].text()
== subtext[i]
):
finded = j
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.textbrowser.setTextCursor(self.textcursor)
tl1 = self.textbrowser.cursorRect(self.textcursor).topLeft()

View File

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