PDA

View Full Version : Image Diplay



Vivek1982
15th October 2013, 11:13
Dear All,

I need to insert an Image(JPEG) on MainWindow just above the Login area. To display the company Logo.. How to load the image on to MainWindow.Any resources file to be created...

Thanks in Advance

stampede
15th October 2013, 12:46
Add a label above the login widget and load the image with QLabel::setPixmap.
Here (http://developer.nokia.com/Community/Wiki/Using_resources_in_Qt) you can find an example of managing image resources.

Vivek1982
16th October 2013, 04:29
Thanks you, I was able to insert Image of PNG format.. If, we need to set the size of image on QLabel means we have to call setMinimum ,max functions or we need to have same size of image.
In the same way, can we set the Window Icon also?

stampede
16th October 2013, 06:41
Do you mean the icon next to window title ? If yes, then use QWidget::setWindowIcon (http://doc.qt.digia.com/4.7/qwidget.html#windowIcon-prop).
If you want to set custom icon of the app file, then read this: setting the application icon (http://qt-project.org/doc/qt-4.8/appicon.html).

About the sizes, I don't know if i understood you correctly, but maybe you need to setScaledContents (http://harmattan-dev.nokia.com/docs/library/html/qt4/qlabel.html#scaledContents-prop)to true.

Susannamoore
4th March 2014, 02:40
Add a label above the login widget and load the image (http://www.rasteredge.com/how-to/csharp-imaging/load-from-file/) with QLabel::setPixmap.
Here (http://developer.nokia.com/Community/Wiki/Using_resources_in_Qt) you can find an example of managing image (http://www.rasteredge.com/dotnet-imaging/) resources.

Thanks for providing example of managing image resources. I really appreciate "Add resources to a resource file".