I'm Confused about set the application icon.
I have seen many explanations about set the application icon, but I'm still not understand.
Please I want a simple explanation, but step by step to understand it
What I have done:
I have created a Qt resource file(.qrc).
Then, I have added a prefix, then I have added the Icon file.
Then, from design mode and from property block I have changed the a property called windowIcon.
Then I have selected the Icon which I added before in the .qrc file.
Notice: I'm use Qt5.3 and windows 7.
Now, Please what is the right steps to set the application icon ?
You have done the right thing to set the main window icon. Just setting windowIcon property in the designer will set an icon for the application window.
For setting an icon to the application executable file there is an automated process In Qt 5.
You can just add the following to the .pro file:
win32: RC_ICONS = myIcon.ico
Also store the .ico file in your application's source code directory.
Note that this is only for Windows. There are other ways to set application icon in Linux and Mac.
Related
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.
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.
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
I have build an app with Code::Block, C++ and wxWidgets. I have changed icon for frame successfully, but icon of .exe file is still there default.
how to change icon of .exe file?
Thanks
Edit .rc file (i.e. resource.rc) and set your icon where you find aaaa ICON.
I want to know if there's a simple way to change my exe icon depending on compilation in release / debug / other configuration.
IDE is Visual Studio 2013, source code in C++.
Thanks in advance.
It may be possible using a combination of tricks.
Create an icon for each configuration and store them each in a folder with the same name as the configurations you use (like Debug, Release).
Use $(ConfigurationName) in a pre-build command line. Create a batch file to copy the correct icon to the 'source' location. In other words if the application icon is .\App.ico create a batch file: 'copy .\%1\App.ico .\App.ico' or similar. (obviously get the paths correct).
The batch will execute and overwrite the app icon with the custom build icon.
Change configuration and the icon can change. Just make sure that all icons are the same size.
I have used this to copy a text file into my builds - cannot see why it cannot work with icons.
I want to change my application exe icon from default. Now when I copied the new icon with same name as default icon had in "res" folder of application. when I compiled it's exe came with new icon.
But at the same time when I copied another icon with another name in "res" folder and include it in my project. Now rese folder has two icons(one icon is for application's icon). Now when I compiled my application that time exe come with new icon. But it should come with old icon as IDR_MAINFRAME holds.
Please help me out.
Thank You
you have to edit the .rc icon file directly. I think it's already write in duplicate post.
I have an MFC application. When the application is launched, I see it is represented on the taskbar using the MFC logo. Also, the application Window Menu Bar has the MFC icon.
How can I replace these with custom made logos?
The icons are in the .ico file that is part of your project. Usually in the /res directory. You can edit them or replace them with files you generate.
The icon file is stored with your project files.
Go to <Projects Folder>\SOLUTIONNAME\PROJECTNAME\res. When you locate this folder, there should be a PROJECTNAME.ico file. rename the ico file you created to PROJECTNAME.ico. Next time you build your project, the MFC icon should be replaced with your custom icon.
I recommend going to this site mostly because it does not require any registration and its 100% free.
You can then fine a suitable icon for your program bu searching keywords.
Then select the .ICO type and download.
Copy the .ico file to your “res” folder.
Then delete the .ico file and rename the downloaded file to .ico.