diff --git a/CHANGELOG.md b/CHANGELOG.md index fde3674d..b8518a2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ - Bugfix: Fixed an issue where commands would sometimes reset if Chatterino was improperly shut down. (#6011) - Bugfix: Fixed a thick border on Windows 11. (#5836) - Bugfix: Fixed some windows not immediately closing. (#6054) +- Bugfix: The emote button no longer looks crunchy. (#6080) - Dev: Subscriptions to PubSub channel points redemption topics now use no auth token, making it continue to work during PubSub shutdown. (#5947) - Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904, #5910, #5903, #5915, #5916, #5930, #5935, #5932, #5943, #5952, #5953, #5968, #5973, #5974, #5980, #5981, #5985, #5990, #5992, #5993, #5996, #5995, #6000, #6001, #6002, #6003, #6005, #6007, #6010, #6008, #6012, #6013, #6015, #6017, #6027, #6028, #6035, #6036, #6040, #6041, #6048, #6058, #6059, #6078, #6079) - Dev: Remove unneeded platform specifier for toasts. (#5914) diff --git a/src/widgets/helper/Button.cpp b/src/widgets/helper/Button.cpp index 5c658cb3..91b65e3d 100644 --- a/src/widgets/helper/Button.cpp +++ b/src/widgets/helper/Button.cpp @@ -76,6 +76,20 @@ void Button::setPixmap(const QPixmap &_pixmap) this->update(); } +void Button::setSvgResource(const QString &resourcePath) +{ + if (resourcePath == this->svgResourcePath) + { + // Same resource path as before - nothing changed + return; + } + + this->svgRenderer = new QSvgRenderer(resourcePath, this); + this->svgResourcePath = resourcePath; + + this->update(); +} + const QPixmap &Button::getPixmap() const { return this->pixmap_; @@ -176,7 +190,13 @@ void Button::paintButton(QPainter &painter) { painter.setRenderHint(QPainter::SmoothPixmapTransform); - if (!this->pixmap_.isNull()) + if (this->svgRenderer != nullptr) + { + painter.setOpacity(this->getCurrentDimAmount()); + + this->svgRenderer->render(&painter); + } + else if (!this->pixmap_.isNull()) { painter.setOpacity(this->getCurrentDimAmount()); diff --git a/src/widgets/helper/Button.hpp b/src/widgets/helper/Button.hpp index b66c8a10..9828a85e 100644 --- a/src/widgets/helper/Button.hpp +++ b/src/widgets/helper/Button.hpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -34,6 +35,7 @@ public: void setMouseEffectColor(std::optional color); void setPixmap(const QPixmap &pixmap_); + void setSvgResource(const QString &resourcePath); const QPixmap &getPixmap() const; void setDim(Dim value); @@ -88,6 +90,8 @@ private: QColor borderColor_{}; QPixmap pixmap_{}; + QSvgRenderer *svgRenderer{}; + QString svgResourcePath; QPixmap resizedPixmap_{}; Dim dimPixmap_{Dim::Some}; bool enableMargin_{true}; diff --git a/src/widgets/splits/SplitInput.cpp b/src/widgets/splits/SplitInput.cpp index 10ea3811..68dbaddc 100644 --- a/src/widgets/splits/SplitInput.cpp +++ b/src/widgets/splits/SplitInput.cpp @@ -165,11 +165,9 @@ void SplitInput::initLayout() textEditLength->setAlignment(Qt::AlignRight); box->addStretch(1); - box.emplace().assign(&this->ui_.emoteButton); + box.emplace