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.
22 lines
544 B
22 lines
544 B
6 years ago
|
#include "fillediconlabel.h"
|
||
|
|
||
|
FilledIconLabel::FilledIconLabel(QWidget* parent) :
|
||
|
QLabel(parent) {
|
||
|
this->setMinimumSize(1, 1);
|
||
|
setScaledContents(false);
|
||
|
}
|
||
|
|
||
|
|
||
|
void FilledIconLabel::resizeEvent(QResizeEvent*) {
|
||
|
// Top pixmap
|
||
|
QIcon icon(":/icons/res/icon.ico");
|
||
|
QSize sz = size();
|
||
|
qDebug() << sz;
|
||
|
QPixmap p(sz);
|
||
|
p.fill(Qt::white);
|
||
|
QPainter painter(&p);
|
||
|
painter.drawPixmap((sz.width() - sz.height()) / 2, 0,
|
||
|
icon.pixmap(sz.height(), sz.height()));
|
||
|
|
||
|
QLabel::setPixmap(p);
|
||
|
}
|