view src/imagelabel.cpp @ 22:0a08c1c2531a 0.0.2

Fix missing include and update translations accordingly
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 14 Apr 2015 18:58:16 +0200
parents 248d5d1cdb38
children 6b9b5efcd7f4
line wrap: on
line source
#include "imagelabel.h"

ImageLabel::ImageLabel(QWidget *parent) :
    QWidget(parent) {
    label = new QLabel(this);
    label->setScaledContents(true);
    label->setFixedSize(0,0);
}

void ImageLabel::resizeEvent(QResizeEvent *event) {
    QWidget::resizeEvent(event);
    resizeImage();
}

const QPixmap* ImageLabel::pixmap() const {
    return label->pixmap();
}

void ImageLabel::setPixmap (const QPixmap &pixmap){
    label->setPixmap(pixmap);
    resizeImage();
}

void ImageLabel::resizeImage() {
    QSize pixSize = label->pixmap()->size();
    pixSize.scale(size(), Qt::KeepAspectRatio);
    label->setFixedSize(pixSize);
}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)