December 23, 2010

endla.ravi endla.ravi
Lab Rat
17 posts

How to insert images in widgets..

 

Hi..basically im new to Qt..

can anyone give me a basic code to load images…

Thanks in advance..

5 replies

December 23, 2010

VCsala VCsala
Lab Rat
339 posts

You can use QPixmap to load images from several sources. If you want to show it, you can use QLabel.

December 23, 2010

QtK QtK
Lab Rat
1140 posts

endla.ravi wrote:
Hi..basically im new to Qt..

can anyone give me a basic code to load images…

Thanks in advance..

New to Qt. Exploring the SDK Doc and examples will help you a lot. There are many relevant examples.

December 23, 2010

Gerolf Gerolf
Area 51 Engineer
3210 posts

Or looking at the tutorials [doc.qt.nokia.com] could also help to orient in Qt.

 Signature 

Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

December 23, 2010

Immii Immii
Ant Farmer
233 posts

You can have code like this:

  1.  QLabel mylabel;
  2. mylabel.setPixmap("myFile.png");
  3. mylabel.show();

Does this works for you?

December 25, 2010

Milot Shala Milot Shala
Lab Rat
393 posts

You can use also QPushButton [doc.qt.nokia.com] to insert images if you want to have button’s capabilities

 
  ‹‹ [Solved] Window attributes and geometry for QMdiSubWindow      How Do I Mask Image Used for QSlider Handle? ››

You must log in to post a reply. Not a member yet? Register here!