forked from hush/SilentDragon
adityapk00
6 years ago
7 changed files with 105 additions and 95 deletions
@ -0,0 +1,22 @@ |
|||
#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); |
|||
} |
@ -0,0 +1,18 @@ |
|||
#ifndef FILLEDICONLABEL_H |
|||
#define FILLEDICONLABEL_H |
|||
|
|||
#include "precompiled.h" |
|||
|
|||
class FilledIconLabel : public QLabel |
|||
{ |
|||
Q_OBJECT |
|||
public: |
|||
explicit FilledIconLabel(QWidget *parent = 0); |
|||
|
|||
public slots: |
|||
void resizeEvent(QResizeEvent *); |
|||
|
|||
}; |
|||
|
|||
|
|||
#endif // FILLEDICONLABEL_H
|
Loading…
Reference in new issue