i used qt to make an application in the tray. on my pc its a good project and i see the icon in the traybar, but when i release it to give it to sombody else they dont see the icon, its just an invissible square that can be used but it dont show the icon. but on my pc it shows the icon. :S i know it sounds weird but does anybody know how to solve it? or how to set the traybar icon in the resource file?
this->setWindowIcon(QIcon("favicon.ico"));
a.start();
createActions();
createTrayIcon();
trayIcon->setIcon(QIcon("favicon.ico"));
trayIcon->setVisible(true);
trayIcon->show();
Well, I assume that you forgot to provide the icon together with the executable. But in any case, it would be better to embed the icon as resource in the executable.
Have a look at the Qt resource documentation. Basically, you just need to create a resource file, add the icon and then change the filename to something like this ":/favicon.ico". By adding the ":/" in front of the filename, Qt knows to load this from the embedded resources.
Related
This seems like a thing that should be quite simple to do, but for some reason I have problems even to google anything on the subject...
How do you add an icon to a console application in Visual Studio. Now, I know how this works with Win32 desktop applications - you have the resource file, and the icon with the lowest ID is simply used as the app's icon. But if I add a new resource file to a console application and even mess around with the icon editor - nothing happens. The target executable still has the same default icon. Is there some kind of difference between a console application and a desktop one regarding resources? Or do I need to also do set something else apart from just adding the resource file with an icon?
Thanks
It should work the same as with normal WinAPI application. In my case the problem was probably caused by windows icons caching. You can verify this is the case by moving the executable to another directory.
The problem appears when I try to build a single binary on Mac. It is working fine when building my application as a bundle. Then it just takes the icon defined in the info.plist.
Another thing is that I want to avoid displaying my application icon in the dock at all? Any way to do that?
I need a solution for one of the issues, either show a custom icon in dock, or don't show any icon.
Have somebody had the same issue and maybe found a workaround or solution?
i want to change style of QWidget tittleBar button like close and minimize in windows but there is no similar stylesheet elements.
i am using Qt5.1 and windows7.
can any body help me?
If you are talking about how to do this windows, you can do:
this->setWindowIcon(QIcon(":myiconfile.png"));
You will have to add the file in your resources.
You can set the window icon on your widget as per documentation with the following property:
windowIcon : QIcon
This property holds the widget's icon.
This property only makes sense for windows. If no icon has been set, windowIcon() returns the application icon (QApplication::windowIcon()).
So, your code would look like something like this:
myWidget->setWindowIcon("/path/to/your/icon/file");
The icon file path can be relative and absolute as well as one coming from the resource system. The easiest way to test it quickly is just to use the absolute path, but if you plan to ship assets with your application to be self-contained, then you can use resource file with the resource system.
am trying to add an icon application that uses freeglut, according to the doc here it seems is enough to have an icon resource GLUT_ICON.
Although it worked, it only appears on the icon of the console window and the executable in windows explorer, but the main window remains with the default windows icon (as shown in the image). I tried building without the console window mode, but I get same behavior, is this the way it suppose to work or am getting a wrong behavior?
This might help clear things for others running into the same problem:
https://www.gamedev.net/forums/topic/151647-opengl-glut-icon/
Basically, in the "file.rc"resource-file (right click view code) that appears after adding an ico resouce, where you should have
MAINICON ICON "compiler_assets\\icon-name.ico" //set main icon to "file"
You should add another line
GLUT_ICON ICON DISCARDABLE "compiler_assets\\icon-name.ico"
Which is basically setting GLUT_ICON to a specific .ico file
Finally fixed this problem. Whether this issues come from the VStudio2012 environment or not is uncertain.
But generating the resource id like this; GLUT_ICON creates a non-defined behavior. The exe is unable to identify this tag as a valid one, therefore no icon can be indexed and found.
By just changing to lower case the string, all problems get fixed.
I did this process manually and the fix seems to be consistent between PC's.
Hi guys :)
I have my console app finished (c++).
And now I'm looking for a way to give it an icon. So when I distribute it, it keeps the icon.
I didn't find anything yet. I would really appreciate some help!
Nobody want to continue helping me? :(
You will need a resource file (.rc) and specify an icon to get it included in the binary. The first icon (the one with the lowest ID number) will be the icon of your application.
Unfortunately the new express editions do not come with an integrated resource editor anymore, but you can use the excellent free alternative ResEd for this task.
You simply have to create a new .rc file, add the icon and then include the .rc file in your c++ project.