![]() |
Resizing an Image QLabel after signal requestFinished
Hi to all!!
We are trying to load an internet image into a QLabel and we are finding some problems with the resizing of the QLabel after the connection. We will try to explain it describing our steps: - Loading a local image into a Qlabel - OK. The QLabel resizes automatically when we load the new image into it. - Loading an external image into a QLabel: The connection to the external url works, and we can load the image into the QLabel after the requestFinished event occurs, but we cannot resize the QLabel to the new image size. - KO. We have tried to use the "update" method of the QLabel but this didn't work. Also, we have tried to modify the size().setWidth() and the size().setHeight but also failed. Can anybody help us out?? Thanks in advance, Best Regards |
Re: Resizing an Image QLabel after signal requestFinished
Can anybody help me out, please?? .
I can't show an image , for example, into a Scroll Area. Thanks in advance. |
Re: Resizing an Image QLabel after signal requestFinished
Quote:
|
Re: Resizing an Image QLabel after signal requestFinished
Quote:
imageLabel->resize(scale * imageLabel->pixmap()->size()); see if it works :) |
Re: Resizing an Image QLabel after signal requestFinished
Quote:
This code works fine and it shows all widgets: QGridLayout *optionsLayout = new QGridLayout; int x=0; QLabel *lastModLabel = new QLabel("Hello"); optionsLayout->addWidget(lastModLabel, x,0); optionsLayout->addWidget(new QLabel("Tag 1"), x, 1); optionsLayout->addWidget(new QLineEdit("QLineEdit"), x, 2); optionsLayout->addWidget(new QPushButton("QPushButton"), x, 3); optionsLayout->addWidget(new QCheckBox("QCheckBox"), x, 4); optionsLayout->addWidget(new QComboBox(), x, 5); optionsLayout->addWidget(new QCalendarWidget(), x, 6); optionsLayout->addWidget(new QCommandLinkButton(), x, 7); optionsLayout->addWidget(new QDial(), x, 8); optionsLayout->addWidget(new QDoubleSpinBox(), x, 9); ui->scrollAreaWidgetContents->setLayout(optionsLayout); But if I do: QImage img("1.jpg"); QLabel *lastModLabel = new QLabel(""); lastModLabel->setPixmap(QPixmap::fromImage(img)); lastModLabel->resize(1 * lastModLabel->pixmap()->size()); optionsLayout->addWidget(lastModLabel, x,0); ui->scrollAreaWidgetContents->setLayout(optionsLayout); The Image doesn't appear into the Scroll Area. Why?. What is it happening?. |
All times are GMT. The time now is 19:16. |
vBulletin® Version 3.8.8