Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
qrcファイルからすべての画像を取得してComboBoxに渡したい。もっと何を言うべきかわからない。それは私が思う非常に基本的な仕事ですが、私は解決策を見つけることができません。
これで正しい軌道に乗るはずです:
foreach( const QString &imageName, QDir(":").entryList() ) { myCombBox->addItem( imageName ); }
これは、すべての画像がリソース ファイルのルートにある場合です。それらが名前空間化されている場合は、に置き換え":"ます:/image_namespace
":"
:/image_namespace
どちらの方法でも、":"はすべてのリソースを含む実際のディレクトリとして扱われ、ファイル システムと同じ方法でアクセスできます。