Files
spark-store/src/widgets/common/customlabel.cpp
zty199 2688e2e849 fix: render error for tag icons in AppInfoPage
SVG render error in Qt6, so fallback to use PNG;
add CustomLabel for render PNG not blurry with HIDPI

Log: add PNG resources for tag icons;
add CustomLabel class for PNG rendering
2025-06-13 01:23:25 +08:00

26 lines
588 B
C++

#include "customlabel.h"
#include <QGuiApplication>
CustomLabel::CustomLabel(QWidget *parent,
Qt::WindowFlags f)
: QLabel(parent, f)
{
}
QPixmap CustomLabel::pixmap() const
{
return QLabel::pixmap();
}
void CustomLabel::setPixmap(const QPixmap &pixmap)
{
QPixmap _pixmap = pixmap;
_pixmap.setDevicePixelRatio(qApp->devicePixelRatio());
_pixmap = _pixmap.scaled(size() * _pixmap.devicePixelRatio(),
Qt::KeepAspectRatio,
Qt::SmoothTransformation);
QLabel::setPixmap(_pixmap);
}