I am working with Qt to create a front-end for my application. Now I wanted to set an customized ICON for my application executable. I am using Qt 6.4. Already I create an resource file which it has .qrc format. Then I added my icon to that resource file. Now I wanted to know how can I set that icon file as executable icon. Is that possible somebody explain how can I set an customized icon for my application? Also I wanted to know how can I modify CMake to instruct compiler which executable should run with administrator privilege. Thank you.
CodePudding user response:
Solution depends on your platform (Windows, mac, Linux) as well as your configuration tool (CMake, qmake).
Have a look at Qt documentation: https://doc.qt.io/qt-6/appicon.html. It tells what to do.
CodePudding user response:
To achieve that, in my side, I'm doing 2 things :
1.
QApplication a(argc, argv);
a.setWindowIcon(QIcon(":/img/AppIcon.png"));
- Create a
resource.rc
file with this content (have to possess a .ico version of the image)
IDI_ICON1 ICON DISCARDABLE "img/AppIcon.ico"
and declare in .pro
RC_FILE = \
resource.rc