fix: missing word wrap in update popup (#5811)

Co-authored-by: Nerixyz <nerixdev@outlook.de>
This commit is contained in:
8thony
2025-01-12 11:29:50 +01:00
committed by GitHub
parent b2d91f6336
commit ae964be758
4 changed files with 39 additions and 14 deletions
+20 -1
View File
@@ -64,6 +64,18 @@ void Label::setHasOffset(bool hasOffset)
this->hasOffset_ = hasOffset;
this->updateSize();
}
bool Label::getWordWrap() const
{
return this->wordWrap_;
}
void Label::setWordWrap(bool wrap)
{
this->wordWrap_ = wrap;
this->update();
}
void Label::setFontStyle(FontStyle style)
{
this->fontStyle_ = style;
@@ -107,7 +119,14 @@ void Label::paintEvent(QPaintEvent *)
painter.setBrush(this->palette().windowText());
QTextOption option(alignment);
option.setWrapMode(QTextOption::NoWrap);
if (this->wordWrap_)
{
option.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
}
else
{
option.setWrapMode(QTextOption::NoWrap);
}
painter.drawText(textRect, this->text_, option);
#if 0