#include "customlabel.h" #include 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); }