fix: missing word wrap in update popup (#5811)
Co-authored-by: Nerixyz <nerixdev@outlook.de>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
- Minor: Remove incognito browser support for `opera/launcher` (this should no longer be a thing). (#5805)
|
||||
- Minor: Remove incognito browser support for `iexplore`, because internet explorer is EOL. (#5810)
|
||||
- Bugfix: Fixed a crash relating to Lua HTTP. (#5800)
|
||||
- Bugfix: Fixed missing word wrap in update popup. (#5811)
|
||||
- Dev: Updated Conan dependencies. (#5776)
|
||||
|
||||
## 2.5.2
|
||||
|
||||
+20
-1
@@ -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
|
||||
|
||||
@@ -27,6 +27,9 @@ public:
|
||||
bool getHasOffset() const;
|
||||
void setHasOffset(bool hasOffset);
|
||||
|
||||
bool getWordWrap() const;
|
||||
void setWordWrap(bool wrap);
|
||||
|
||||
protected:
|
||||
void scaleChangedEvent(float scale_) override;
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
@@ -43,6 +46,7 @@ private:
|
||||
QSize preferedSize_;
|
||||
bool centered_ = false;
|
||||
bool hasOffset_ = true;
|
||||
bool wordWrap_ = false;
|
||||
|
||||
pajlada::Signals::SignalHolder connections_;
|
||||
};
|
||||
|
||||
@@ -19,7 +19,8 @@ UpdateDialog::UpdateDialog()
|
||||
LayoutCreator<UpdateDialog>(this).setLayoutType<QVBoxLayout>();
|
||||
|
||||
layout.emplace<Label>("You shouldn't be seeing this dialog.")
|
||||
.assign(&this->ui_.label);
|
||||
.assign(&this->ui_.label)
|
||||
->setWordWrap(true);
|
||||
|
||||
auto buttons = layout.emplace<QDialogButtonBox>();
|
||||
auto *install = buttons->addButton("Install", QDialogButtonBox::AcceptRole);
|
||||
@@ -52,18 +53,18 @@ void UpdateDialog::updateStatusChanged(Updates::Status status)
|
||||
switch (status)
|
||||
{
|
||||
case Updates::UpdateAvailable: {
|
||||
this->ui_.label->setText((
|
||||
getApp()->getUpdates().isDowngrade()
|
||||
? QString(
|
||||
"The version online (%1) seems to be\nlower than the "
|
||||
"current (%2).\nEither a version was reverted or "
|
||||
"you are\nrunning a newer build.\n\nDo you want to "
|
||||
"download and install it?")
|
||||
.arg(getApp()->getUpdates().getOnlineVersion(),
|
||||
getApp()->getUpdates().getCurrentVersion())
|
||||
: QString("An update (%1) is available.\n\nDo you want to "
|
||||
"download and install it?")
|
||||
.arg(getApp()->getUpdates().getOnlineVersion())));
|
||||
this->ui_.label->setText(
|
||||
(getApp()->getUpdates().isDowngrade()
|
||||
? QString(
|
||||
"The version online (%1) seems to be lower than the "
|
||||
"current (%2).\nEither a version was reverted or "
|
||||
"you are running a newer build.\n\nDo you want to "
|
||||
"download and install it?")
|
||||
.arg(getApp()->getUpdates().getOnlineVersion(),
|
||||
getApp()->getUpdates().getCurrentVersion())
|
||||
: QString("An update (%1) is available.\n\nDo you want to "
|
||||
"download and install it?")
|
||||
.arg(getApp()->getUpdates().getOnlineVersion())));
|
||||
this->updateGeometry();
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user