KNewStuff
Go to the documentation of this file.
20 #include <QtGui/QPaintEvent>
21 #include <QtGui/QPainter>
35 m_frameImage = QPixmap(framefile);
41 m_scaledImage = QImage();
48 QWidget::mousePressEvent(event);
54 QWidget::resizeEvent(event);
55 m_scaledImage = QImage();
61 if (m_image.isNull()) {
65 QPainter painter(
this);
66 int margin = painter.fontMetrics().height() / 2;
69 int width = contentsRect().width();
70 int height = contentsRect().height();
72 if (m_scaledImage.isNull()) {
73 QSize scaled =
QSize(qMin(width - 2*margin, m_image.width()*2), qMin(height - 2*margin, m_image.height()*2));
74 m_scaledImage = m_image.scaled(scaled, Qt::KeepAspectRatio, Qt::SmoothTransformation);
79 point.setX(contentsRect().left() + ((width - m_scaledImage.width()) / 2));
80 point.setY(contentsRect().top() + ((height - m_scaledImage.height()) / 2));
82 QPoint framePoint(point.x() - 5, point.y() - 5);
83 painter.drawPixmap(framePoint, m_frameImage.scaled(m_scaledImage.width() + 10, m_scaledImage.height() + 10));
84 painter.drawImage(point, m_scaledImage);
89 if (m_image.isNull()) {
92 QSize sh = m_image.size();
93 sh.scale(maximumSize(), Qt::KeepAspectRatio);
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jun 1 2013 20:21:42 by
doxygen 1.8.3.1 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.