Results 1 to 2 of 2

Thread: Adding files to QIcon array members

  1. #1
    Join Date
    Jan 2008
    Posts
    91
    Thanks
    8

    Default Adding files to QIcon array members

    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?

    Qt Code:
    1. for(i=0;i<5;i++)
    2. icon[i].addFile("deneme(i).bmp",i);
    3. size=QSize(130,93);
    4. a[0]=ui.pushButton;
    5. a[1]=ui.pushButton_2;
    6. a[2]=ui.pushButton_3;
    7. a[3]=ui.pushButton_4;
    8. a[4]=ui.pushButton_5;
    9. for(i=0;i<5;i++)
    10. {
    11. a[i]->setIcon(icon[i]);
    12. a[i]->setIconSize(size);
    13. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Adding files to QIcon array members

    See QString::arg():
    Qt Code:
    1. QString("deneme(%1).bmp").arg(i)
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

Similar Threads

  1. Make error with Qt Jambi 4.3.2_01
    By pamalite in forum Installation and Deployment
    Replies: 0
    Last Post: 22nd November 2007, 12:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.