here the code is working fine and all array of buttons are setcolor to red,now when i try to implement the same code by using function means i send row and coloums positions to an functions and setcolor of that buttons in that function than it doesnt work..code i have used is

I tried to reproduce your problem using the example below, but the styleheet works for me and the buttons are red. Does the example below reproduce your problem? If not, can you modify it so that it does? Which version of Qt are you using and on which platform?

Do you mean that you are using Qt 4.7.1? Qt 1.1 did not have stylesheets...

Does the example I pasted above work for you? If it does work, can you change it so that it shows your problem? That will make it easier to pinpoint what the problem is. If my example does not work for you, can you try upgrading to Qt 4.7.3 to see if that helps?

yeh i get the error but dont know how to solve it..actually inside the function where i use to setcolor in the button i used enum in switch case...once i removed the enum its setting color so what does it mean

The fact that an enum is used in a switch case should not cause any problems per say. Can you post a stand alone, small example that shows the problem? That way, we can reproduce the problem and investigate what the cause can be.