PDA

View Full Version : how i can add image in my toolbar



jyoti
19th December 2006, 06:44
hi all
i have some icons in toolbar size of 48x48 each having some actions and now i want to add image on remaining space ....when i add image as icon in remaining space but it looks very small....i want to add proper image in toolbar on click of image it may open another URL....
means when i click on image it open another dialog which have some information....

i had add icons through designer...so is there any need of programming to add image or what...
plz tell be about how to add image in toolbar (image navigation)...

my form is attached below

wysota
19th December 2006, 07:16
Add a QLabel widget to the toolbar and place your image in it as a pixmap.

jyoti
19th December 2006, 07:32
thanks but i wanna add it as icon through designer
i had add all icons through resource editor and made a .QRC file (in which all icons are defined and declared) so i wanna same for image through which i ll use the object name and put the url on object in resource editor....
i tried to use QLabel but it is not in use like adding oject on another object
becoz toolbar it self is an object and using another object i.eQLabel is not working

plz do tell if there any solution through designer otherwise by Programming
thanks in advance

wysota
19th December 2006, 10:52
thanks but i wanna add it as icon through designer
Unfortunately we don't always get what we want. You'll have to do it manually.


i had add all icons through resource editor and made a .QRC file (in which all icons are defined and declared) so i wanna same for image through which i ll use the object name and put the url on object in resource editor....
That doesn't mean you can't use the resource from hand written code...


i tried to use QLabel but it is not in use like adding oject on another object
becoz toolbar it self is an object and using another object i.eQLabel is not working
I don't know what you mean but this certainly works:

QLabel *l = new QLabel(this);
l->setPixmap(QPixmap(":/myresource.png"));
toolBar->addWidget(l);

jyoti
19th December 2006, 12:10
thanks
see i am using code like as u mensioned

QLabel *l = new QLabel(toolBar);
l->setPixmap(QPixmap(":/images/DPRstrip.png"));


here images is my folder's name where DPRstrip.png is placed
bt it still not showing any image
but setText is showing message typed
i am using MAC Os

wysota
19th December 2006, 13:47
Is the image added to a resource file and is the resource file compiled into the app?

jyoti
19th December 2006, 15:01
everything is included
this code completly working on intel based PC
but its ot working on Power PC

wysota
19th December 2006, 15:39
The paths are probably incorrect somewhere (are you using relative paths anywhere?)... are you sure you are using the resource system? MacOSX launches its apps with a different working directory than Windows or Linux which might be the thing causing problems when using relative paths.