PDA

View Full Version : Adding files to QIcon array members



anafor2004
26th January 2008, 15:11
Hi All
I have another question here , first i try to explain what i try to do, On my form there are 5 pushbuttons and i want to load them.I prepare a for loop but i dont know how can i load
these files.My photos names are like this "deneme(0).bmp", "deneme(1).bmp",deneme(3).bmp".... etc

How can i do this?


for(i=0;i<5;i++)
icon[i].addFile("deneme(i).bmp",i);
size=QSize(130,93);
a[0]=ui.pushButton;
a[1]=ui.pushButton_2;
a[2]=ui.pushButton_3;
a[3]=ui.pushButton_4;
a[4]=ui.pushButton_5;
for(i=0;i<5;i++)
{
a[i]->setIcon(icon[i]);
a[i]->setIconSize(size);
}

jpn
26th January 2008, 15:46
See QString::arg():

QString("deneme(%1).bmp").arg(i)