PDA

View Full Version : QLabel setPixmap doesnt work



arpspatel
1st March 2010, 21:44
void theGui::setImageLabel(QLabel* _label, IplImage* image){
_label->setPixmap(QPixmap::fromImage(Ipl2QImage(image)).sc aled(_label->size(),Qt::KeepAspectRatio));
}

This one works fine..



void theGui::setImageLabel(QLabel* _label, QString image){
_label->setPixmap(QPixmap(image).scaled(_label->size(),Qt::KeepAspectRatio));
}

This one doesnt work.. no image displayed


Can you please tell me why above one doesnt work, I tried various things like QPixmap::fromImage(QImage(image)) , but still doesnt work...

Thank you very much

Arpit

Lykurg
1st March 2010, 22:01
Are you really sure "image" is a valid path to an image? And what format is the image? Do you have the right image plugins for that?...

arpspatel
1st March 2010, 22:16
"image" is a valid path, also i can load it as IplImage (OpenCV) but cant seem to use it with setPixmap, its JPG file,

Do i need plugins as this is just basic image viewing.. how do i use the plugins, do i just copy qjpeg4.dll to the app dir...

Thanks
Arps

Lykurg
1st March 2010, 22:24
Hi,

first make sure it is really because of the plugin. If so, see http://doc.trolltech.com/4.6/deployment-windows.html#qt-plugins for the location of the plugins.


Lykurg