You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
460 B
C++
25 lines
460 B
C++
#include "cpixmapwidget.h"
|
|
|
|
#include <QPainter>
|
|
|
|
|
|
cPixmapWidget::cPixmapWidget(QWidget *parent) : QWidget(parent)
|
|
{
|
|
|
|
}
|
|
|
|
void cPixmapWidget::setPixmap(const QPixmap& pixmap)
|
|
{
|
|
m_pixmap = pixmap;
|
|
}
|
|
|
|
void cPixmapWidget::paintEvent(QPaintEvent *event)
|
|
{
|
|
if(!m_pixmap.isNull())
|
|
{
|
|
QPainter painter(this);
|
|
painter.drawPixmap(0, 0, m_pixmap.scaled(width(), height(), Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation));
|
|
}
|
|
QWidget::paintEvent(event);
|
|
}
|