PDA

View Full Version : How to paste image on the form through designer



deekayt
10th November 2006, 16:26
Please tell as to how to paste the image ( jpeg/png) on the form in designer.

Thanks

jacek
10th November 2006, 17:26
Use QLabel.

deekayt
10th November 2006, 18:08
I did use the Qlabel only and then I chose the pixmap from the property editor. The pixmap was a png file.
It does come on the form and even in the preview window
But when I make the entire thing the image is missing
I then put the png file in the release folder. It still did not work out
Am I missing something.
As far as the png files for icon are concerned when I put them in the release folder they start showing up in the final version.
Where am I going wrong.:confused:

jacek
10th November 2006, 19:05
The best solution is to use resources (http://doc.trolltech.com/4.2/resources.html), but if you prefer to load images from disk, make sure you use proper paths.

Note that relative paths depend on current working directory, which might change depending how users start your application. The safest way is to load them in the code using absolute paths constructed from QCoreApplication::applicationDirPath(), QDir::separator() and relative path to your image.

deekayt
10th November 2006, 21:06
I have taken the resources approach
Somehow I am missing something somewhere
I am sending you the code ( attached along)
Can u pinpoint the mistake
PS -- I always amend my makefile to takeout all references of debug since my make gives me trouble of cannot find - lqtmaind ( and I am in no mood to sort that out). This has been working fine so donot take that as mistake.
What else am I missing.

jacek
12th November 2006, 18:58
The problem is that your .ui file doesn't use resources, but files. When you assign a pixmap to a label, make sure you select "specify resource" instead of "specify image file".

deekayt
13th November 2006, 16:34
Dear JACEK
My problem of Thread 24 regrading " How To Redirect The Console Output To A Text Browser/pop Up " in QT PROGRAMMING FORUM is still not sorted out
I know this is bit twisted but I am actually stuck up

wysota
13th November 2006, 16:44
Dear JACEK
My problem of Thread 24 regrading " How To Redirect The Console Output To A Text Browser/pop Up " in QT PROGRAMMING FORUM is still not sorted out
I know this is bit twisted but I am actually stuck up

How is it related to this thread?