Hush full node GUI wallet
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 lines
766 B

// Copyright 2019-2021 The Hush developers
// Released under the GPLv3
#include "fillediconlabel.h"
FilledIconLabel::FilledIconLabel(QWidget* parent) :
QLabel(parent) {
this->setMinimumSize(1, 1);
setScaledContents(false);
}
void FilledIconLabel::setBasePixmap(QPixmap pm) {
basePm = pm;
}
/**
* When resized, we re-draw the whole pixmap, resizing it as needed.
*/
void FilledIconLabel::resizeEvent(QResizeEvent*) {
QSize sz = size();
QPixmap scaled = basePm.scaled(sz, Qt::KeepAspectRatio, Qt::SmoothTransformation);
QPixmap p(sz);
p.fill(Qt::white);
QPainter painter(&p);
painter.drawPixmap((sz.width() - scaled.width()) / 2, (sz.height() - scaled.height()) / 2, scaled);
QLabel::setPixmap(p);
}