#include "mainwindow.h"
#include <QtGui>
MainWindow::MainWindow(QWidget *parent) :
QWidget(parent)
{
QHBoxLayout *lay=new QHBoxLayout;
setLayout(lay);
QImage image("comando.jpg");
QLabel *imageLabel = new QLabel(this);
lay->addWidget(imageLabel);
imageLabel->setPixmap(QPixmap::fromImage(image.scaled(400,400,Qt::KeepAspectRatio,Qt::FastTransformation)));
qDebug() << imageLabel->pixmap()->size();
}
MainWindow::~MainWindow()
{
}
#include "mainwindow.h"
#include <QtGui>
MainWindow::MainWindow(QWidget *parent) :
QWidget(parent)
{
QHBoxLayout *lay=new QHBoxLayout;
setLayout(lay);
QImage image("comando.jpg");
QLabel *imageLabel = new QLabel(this);
lay->addWidget(imageLabel);
imageLabel->setPixmap(QPixmap::fromImage(image.scaled(400,400,Qt::KeepAspectRatio,Qt::FastTransformation)));
qDebug() << imageLabel->pixmap()->size();
}
MainWindow::~MainWindow()
{
}
To copy to clipboard, switch view to plain text mode
Now all the time i want change the imagelabel i will need to set again the pixmap :s I resize the image all the time that the user will change the mainwindow size.
Bookmarks