Thursday, August 28th 2008, 6:38pm UTC+1

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to QtForum.org. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

rasheed

Beginner

Posts: 9

Location: Pune

Occupation: Software Engineering

1

Friday, April 18th 2008, 5:23pm

Dispalying Image on a Dialog

Hi ,
i am a new bee to QT development from yesterday itself I have install QT on my machine even in our team nobody knows QT so please you snippet will be helpful because we don’t have time to do R & D, My task is to display an image on the Dialog window. (my image will be as a binary format or may be file)

its very simple fashion way in VC++ as below:
take one picture static label, and displaying the image. In VC++ its very simple:
1) LoadImage(NULL,fileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE);

2) SendDlgItemMessageW(hWnd,IDC_PictureBmp,STM_SETIMAGE,IMAGE_BITMAP,(LPARAM)hBitmap);
(IDC_PictureBmp is the picture control id)

So I want to be done in the same lines because it's very easy way to display the image, otherwise I need to write the onpaint(), ondraw(), function and onpaint(), ondraw(), procedure is very complex way(if onpaint(), ondraw procedure easy please let me know with the code).


Can you please help me how to do in QT.

I find one option in V3.3.8 version QT i.e pixmaplabel in Display Section but same option I am unable to find in V4.3.4 version. in both version how to do please give me some snippet.

otherwise here i am explaining my approach please let me know if i missed out anything.

1) Start -> Run -> devenv -> (Project types) Q3Projects -> (Templates) Qt3 Application -> ok -> Finish
2) Open the Solution Explorer -> Right click on Form Files -> add qform -> it will open the qt designer -> right side you will find Display section -> PixmapLabel -> drag on the Dialog -> right click Choose Pixmap -> add image you want-> click ok

now i can see the image on the dialog but after i execute the application i am unable to see the image on the dialog. i know in the main something i need to write to display image, what i need to do please explain anybody ?

and one more thing is i am unable to see the pixmapLabel in display Widgets section in QT4.3 so what is the substitute for the pixmapLabel, kindly let me know this ?

my above all assuming may be wrong please guid me what i need to do to display the image on the dialog and (my image will be the binary string or image file).

iam using windows 2003 OS

Regards
Rasheed.

This post has been edited 1 times, last edit by "rasheed" (Apr 18th 2008, 5:28pm)

  • Go to the top of the page

2

Sunday, April 20th 2008, 2:11pm

RE: Dispalying Image on a Dialog

i see, it is easy.
your object to declare dialog variable is imgDlg, (e.g)
please write below code
imgDlg->setPaletteBackgroundPixmap(QPixmap(imagepath - your image path));
  • Go to the top of the page

Rate this thread