PDA

View Full Version : Simple display of an image



bruccutler
15th January 2007, 23:44
Hello,
Another really dumb question. I need to display a standard image (.jpg, .bmp, etc.) as a title in a window. I think that the label can do this, but I can't figure out how to set it up to display a pixmap.

Where can I find some simple code that shows me how to load an image and display it in a dialog?
- BRC

wysota
15th January 2007, 23:49
QDialog dlg;
QHBoxLayout *l = new QHBoxLayout(&dlg);
QLabel *label = new QLabel;
l->addWidget(label);
label->setPixmap(QPixmap("/usr/share/icons/crystalsvg/128x128/apps/tux.png"));
dlg.exec();