How to get the file/resource path for a QIcon

扶醉桌前 提交于 2019-12-10 16:36:39

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/1685808/how-to-get-the-file-resource-path-for-a-qicon

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!