Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get all images from a qrc file?

I want to get all images from my qrc file and pass them to a ComboBox. Don't know what to say more. It's a very basic task I think but I can't find a solution.

like image 276
yokmp Avatar asked Apr 01 '12 20:04

yokmp


1 Answers

This should get you on the right track:

foreach( const QString &imageName, QDir(":").entryList() )
{
    myCombBox->addItem( imageName );
}

This is if all of your images are at the root of your resource file. If they're namespaced then replace ":" with :/image_namespace

Either way, the ":" is treated as an actual directory containing all of your resources and is accessible in the same way as your file system.

like image 160
Chris Avatar answered Oct 13 '22 16:10

Chris