PDA

View Full Version : TypeCasting issue.



baluk
29th October 2010, 07:31
Hi,

I have few buttons added to my UI file. Now I want to read those buttons into an array. is it possible to do this. I tried something, but getting errors.



QObject buttons[10];
buttons[1] = (QObject) ui->pushbutton1;


I have written this code because I remembered of doing something like this in other languages (.NET, Java). Thanks in advance.

Baluk

squidge
29th October 2010, 07:37
Did you try:



QButton *buttons[10];
buttons[0] = ui->pushButton1;

SixDegrees
29th October 2010, 07:45
It would be helpful to know what errors you are getting.

baluk
29th October 2010, 08:03
Thanks squidge. It is working now. I used QPushButton directly insted of Q3Button.