feat: setting to change emote/badge thumbnail size (#6126)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Arne
2025-06-15 12:27:43 +02:00
committed by GitHub
parent 746b1c9210
commit 62c93d1d98
8 changed files with 98 additions and 27 deletions
+19
View File
@@ -7,6 +7,8 @@
#include <QPainter>
#include <utility>
namespace {
// number of columns in grid mode
@@ -30,6 +32,23 @@ inline constexpr T *tooltipParentFor(T *desiredParent)
namespace chatterino {
TooltipEntry TooltipEntry::scaled(ImagePtr image, QString text, float scale)
{
auto entry = TooltipEntry{
.image = std::move(image),
.text = std::move(text),
};
if (entry.image)
{
auto imgWidth = entry.image->width() / entry.image->scale();
auto imgHeight = entry.image->height() / entry.image->scale();
entry.customWidth = static_cast<int>(imgWidth * scale);
entry.customHeight = static_cast<int>(imgHeight * scale);
}
return entry;
}
TooltipWidget::TooltipWidget(BaseWidget *parent)
: BaseWindow({BaseWindow::TopMost, BaseWindow::DontFocus,
BaseWindow::DisableLayoutSave},