Zack Rusin | 5cb6b87 | 2011-04-10 02:19:59 -0400 | [diff] [blame] | 1 | #include "imageviewer.h" |
| 2 | |
| 3 | #include <QPainter> |
| 4 | #include <QPixmap> |
| 5 | |
| 6 | ImageViewer::ImageViewer(QWidget *parent) |
| 7 | : QDialog(parent) |
| 8 | { |
| 9 | setupUi(this); |
| 10 | |
| 11 | QPixmap px(32, 32); |
| 12 | QPainter p(&px); |
| 13 | p.fillRect(0, 0, 32, 32, Qt::white); |
| 14 | p.fillRect(0, 0, 16, 16, QColor(193, 193, 193)); |
| 15 | p.fillRect(16, 16, 16, 16, QColor(193, 193, 193)); |
| 16 | p.end(); |
| 17 | QPalette pal = scrollAreaWidgetContents->palette(); |
| 18 | pal.setBrush(QPalette::Background, |
| 19 | QBrush(px)); |
| 20 | pal.setBrush(QPalette::Base, |
| 21 | QBrush(px)); |
| 22 | scrollAreaWidgetContents->setPalette(pal); |
| 23 | } |
| 24 | |
| 25 | void ImageViewer::setImage(const QImage &image) |
| 26 | { |
| 27 | QPixmap px = QPixmap::fromImage(image); |
| 28 | imageLabel->setPixmap(px); |
| 29 | } |
| 30 | |
| 31 | #include "imageviewer.moc" |