Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the file/resource path for a QIcon

Tags:

c++

qt

qicon

So let's say I do something like this:

QIcon myIcon(":/resources/icon.ico");

How can I later determine the path for that icon, e.g.

QString path = myIcon.getPath();

The problem is, there is no getPath() member, and I can't find anything similar, but surely there must be a way!

I guess I could inherit the QIcon class and add this functionality, but it's probably built in and I'm overlooking it?

like image 233
y2k Avatar asked Nov 06 '09 06:11

y2k


1 Answers

The filename isn't stored in QIcon, it's only used for constructing the image.

like image 91
codelogic Avatar answered Oct 01 '22 03:10

codelogic