View Full Version : Replacing One image with another

8th February 2007, 08:08
Hi all

I am working on Qt3.1(Red HAt Linux).I m having a Tree Structure of various Files and Folders.Files and Folders both are represented by different different images.
Now what I want is That When I Click on a Particular File or Folder Having different images is being replaced by another images.



Now when I select a Particular File
i.e When I Click on FileItem then image1 Can be Replaced By any another image say image3.

same for folders

Now when I select a Particular Folder
i.e When I Click on Folder then image2 Can be Replaced By any another image say image4

Please do reply with example.


8th February 2007, 10:09
Use a signal-slot connection and replace the pixmap with another one.

8th February 2007, 10:23
Thanx 4 ur reply But is there any other alternative .

8th February 2007, 10:46
Any alternative to what? You can always just... do nothing :)

8th February 2007, 11:19
OhThanx for telling Me That i just do nothing and From now I wont ask for ur help Ok:o

8th February 2007, 11:50
You asked for help, you were given help. I gave you the simplest solution possible and you didn't like it. Without more information I won't give you another solution as I don't know what is wrong with the first one I gave.

Basically you do something by calling respective methods from classes handling the component you use and the way to change the image displayed is to call a method for... changing the image which is called setPixmap(). If you don't want to use it, then simply subclass and implement your own painting based on whatever you like.

I take it that we're talking about QListViewItems, so you have a signal which is emitted when en entry is clicked and you have a method to call to set a new image. What more do you want?

8th February 2007, 13:22
Sorry , Yaa Its My fault that I wont explained you properly what i want.