equal
deleted
inserted
replaced
31 { |
31 { |
32 Q_UNUSED(event); |
32 Q_UNUSED(event); |
33 |
33 |
34 QPainter painter(this); |
34 QPainter painter(this); |
35 int pixsize; |
35 int pixsize; |
36 if (width() > height()) { |
36 if (width() > height()) |
|
37 { |
37 pixsize = height(); |
38 pixsize = height(); |
38 painter.translate((width() - pixsize) / 2, 0); |
39 painter.translate((width() - pixsize) / 2, 0); |
39 } else { |
40 } |
|
41 else |
|
42 { |
40 pixsize = width(); |
43 pixsize = width(); |
41 painter.translate(0, (height() - pixsize) / 2); |
44 painter.translate(0, (height() - pixsize) / 2); |
42 } |
45 } |
43 painter.drawPixmap(0, 0, pixsize, pixsize, pixmap.scaled(pixsize, pixsize, Qt::KeepAspectRatio)); |
46 painter.drawPixmap(0, 0, pixsize, pixsize, pixmap.scaled(pixsize, pixsize, Qt::KeepAspectRatio)); |
44 } |
47 } |