Any idea why the code below succeeds for small *.png's (300 pixels) but fail (i=0, j=0) for bigger (1700*900 pixels)?
void viewImage::showImage(const QString file, QLabel* theLabel)
{
theLabel->hide();
QPixmap* image;
image = new QPixmap(file);
int i = image->width(); //TODO: Remove - debug purpose only
int j = image->height(); //TODO: Remove - debug purpose only
if (!image->isNull())
{
theLabel->setPixmap(*image);
}
theLabel->show();
}
PS. 700*600 resulted in KERN-EXEC 3, i.e. the image was not Null, but the system couldn't handle it...
PPS. Scaling the image works for medium sized, as they are not Null, but the main queastion remains: why "new QPixmap()" fails for large file.
// Not using "..ToWidth" or "..ToHeight" as "scaled" covers both!
theLabel->setPixmap(image->scaled(350,200,Qt::KeepAspectRatio,Qt:: SmoothTransformation));
This post has been edited 4 times, last edit by "kalastaja" (Aug 27th 2009, 9:23am)