mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-14 21:02:04 +08:00
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
This commit is contained in:
25
src/widgets/common/customlabel.cpp
Normal file
25
src/widgets/common/customlabel.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#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);
|
||||
}
|
||||
Reference in New Issue
Block a user