I use PyInstaller to get a single file executable from my python script.
as seen in this thread : Pyinstaller setting icon
it is not that complicated to add a icon to the .exe file.
Except that it adds 2 icons :
* when I show "Medium icons" (or bigger) in the windows explorer, then I see the standard PyInstaller icon
* when I show "small icons" (or smaller, like in "details view") then I get the icon I specified.
With a "iconviewer" I can see that the default icon is mine, but the PyInstaller icon has ID=1
is there a method to get avoid this second (ID=1) icon ?
My icon is already 256x256 big...
According to this answer https://stackoverflow.com/a/3244679/4316500 Windows 7 does not need bigger icons.
It seems that the problem solve itself alone...
The day (and a reboot) after my long time search on that problem, the icon was OK.
Perhaps the Windows cache for icons where preventing me to see the right icon.
Still not clear because I'm also sure that my iconviewer saw 2 different icons. Now, I have twice the same (and wanted) icon. It's twice too much, but nobody sees it.
Related
I'm playing with Mingw and embedding Icons. I add a single Icon by using windres and linking it in at compile time.
TRAY_ICON ICON "np.ico"
The Icon for the executable shows as the linked one, and opening the file with CFF explorer or similar tools show the Icon in the resource section.
When loading the Icon from within the application I use LoadIcon like below:
LoadIcon(GetModuleHandle(NULL), "TRAY_ICON");
Which works as expected and I can use the Icon for whatever. When looking at other executables I can see multiple Icons in the resources however. These are similar and are only different in size.
With multiple Icons present in the resource section, how does Windows decide which one to use when viewing the file in explorer or similar?
How are specific Icons selected when specifying a given Icon group?
K, so solved both, just forgot to post an answer here.
Windows uses the first icon group for the program icon.
Icon files can contain multiple images. Use the Linux imagemagic package to merge them. Windows decides which one to use based on size.
I am using TortoiseGit and the overlay icons show up for the folders and not the files. I came across this page http://blog.garethjmsaunders.co.uk/2015/03/22/managing-overlay-icons-for-dropbox-and-tortoisesvn-and-tortoisegit/ which I tried, but that still doesn't solve the problem.
Right now in my registry/ShellIconOverlayIdentifiers, Tortoise icons take precedence over any other application.
Any ideas?
Thanks.
The reason might be that you excluded the folder/drive type on TortoiseGit settings -> Icon overlays (https://tortoisegit.org/docs/tortoisegit/tgit-dug-settings.html#tgit-dug-settings-overlay; you might need to check "Network drive", "Drives A: and B:" and/or "Removable Drive" depending on the drive type). When "Show excluded as normal" is checked, all folders will have a "normal" overlay icon and files don't have any overlay icon.
Please also see https://tortoisegit.org/support/faq/#ovlnotshowing
I came here using Windows 11 and I had the same issue. No file icon overlays but the icon overlays for the folders were present. MrTux's first link showed the Icon Overlays screen in Git->Settings and I noticed that my status cache had been set to None. Setting back to Default got things working again for me.
When I create the "Command link button" (QCommandLinkButton) it has relatively nice green arrow icon.
I would like to see what other nice icons can I choose. When I try to change the icon, [Theme] appears instead of path or some GUI selection dialog:
I also noticed the context menu:
When I click Set icon from theme, again expecting some GUI selection list, I get just a text field:
What I was imagining:
Where's the list of icons from which the green arrow was taken?
QIcon::fromTheme works under specific conditions.
If it can find it in the QIcon::themeSearchPaths() for the QIcon::themeName()
If the desired icon isn't there, Qt Designer won't be able to do any of the from theme, named icons.
But... if you check your target system for the theme search paths and set the theme name, you are more likely to have success.
Example
On linux, I wanted to get a plus and a minus icon.
I found list-add.png and list-remove.png fit the bill.
https://github.com/GNOME/adwaita-icon-theme/tree/master/Adwaita/16x16/actions
http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
I did a locate on my system and found these:
/usr/share/icons/gnome/16x16/actions/list-add.png
...
/usr/share/icons/gnome/32x32/actions/list-add.png
/usr/share/icons/gnome/scalable/actions/list-add.svg
/usr/share/icons/oxygen/16x16/actions/list-add.png
...
Forcing with fallback icon in QIcon::fromTheme
Find the icon on the filesystem:
ui->toolButton->setIcon(QIcon::fromTheme("list-add",
QIcon("/usr/share/icons/gnome/16x16/actions/list-add.png")));
Find the icon in the qt resource system...
Add the icon in a qrc file in your build, then reference it's path.
ui->toolButton->setIcon(QIcon::fromTheme("list-add",
QIcon(":/list-add.png")));
Overriding the current icon theme
qDebug() << "themeSearchPaths:" << QIcon::themeSearchPaths() << QIcon::themeName();
// themeSearchPaths: ("/usr/local/share/icons", "/usr/share/icons", ":/icons") "hicolor"
The default theme for the system, and for the target deployment machine, likely didn't have the icons in it I wanted... but the gnome or oxygen icon desktop theme installed would almost always have it...
QIcon::setThemeName("oxygen");
Note that you won't see the preview in Qt Designer necessarily because it doesn't set the theme until runtime of your code.
The gnome icon library has 1100+ icons in it. Here is one list:
https://gist.github.com/peteristhegreat/c0ca6e1a57e5d4b9cd0bb1d7b3be1d6a
This works as long as you know what themes are available on the target system.
The list from freedesktop.org has 286 icons listed.
Use icons included in Qt
Just like #peppe pointed out, Qt includes 70 standard icons, too.
widget->setIcon(widget->style()->standardIcon(QStyle::SP_BrowserReload));
http://doc.qt.io/qt-5/qstyle.html#StandardPixmap-enum
Conclusion
Using a stock library on your target system is probably the fastest. Using the Qt built-ins is fast to figure out and use, but is fairly limited. Using a resource file is probably the most robust method, and gives unlimited options on what icon to use.
Be sure to pick a standard icon pack, and think about licensing and attributions, and some other things like that.
And there is no shortage of icons available online:
https://www.quora.com/What-is-the-best-icon-library
https://www.google.com/search?q=open+source+icon+library
Hope that helps.
I don't think that's the function you want to use. The "theme" name there corresponds to the QIcon::fromTheme functionality, which uses icons named according to the FDO specification
http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
And they're not really supported on non-FDO platforms (Windows, Mac, ...) unless you deploy your own theme files.
Now some stock icons are shipped with Qt itself; I don't know how to set them from Designer, but from code you can use QStyle::standardIcon:
widget->setIcon(widget->style()->standardIcon(QStyle::SP_BrowserReload));
If the icon you need is not provided by Qt, you'll need to ship it. In that case the Resource System is a convenient way to bundle it alongside your executable.
Last, but not least, from a UX point of view you should consider using QToolButtons unless you're really building a Vista-like wizard.
I've tried this about nine different ways tonight (and read through all the SO responses to similar issues, all of which have a straightforward similar resolution that doesn't seem to be working for me).
I'm getting this response from Apple after submission:
We have discovered one or more issues with your recent delivery for "[App Name]". Your delivery was successful, but you may wish to correct the following issues in your next delivery:
Missing recommended icon file - The bundle does not contain an app icon for iPhone / iPod Touch of exactly '120x120' pixels, in .png format.
Missing recommended icon file - The bundle does not contain an app icon for iPad of exactly '76x76' pixels, in .png format.
Missing recommended icon file - The bundle does not contain an app icon for iPad of exactly '152x152' pixels, in .png format.
Now, normally the advice is to make sure those app icon sizes are included, obviously, but also in the Info.plist.
The problem is that I've verified that they're in both — I have Icon-76.png, Icon-120.png, and Icon-152.png in the app bundle along with all the other pre-iOS-7 icons, and Info.plist includes, under "Icon files", "Icon-76.png", "Icon-120.png", and "Icon-152.png" along with all the other icon filenames.
I've cleaned, deleted any other developer-rejected archives, checked to make sure the archive from the Organizer has the icons and updated Info.plist, and tried rejecting and resubmitting several times, always receiving the missing-icons email upon the otherwise successful submission.
Has anyone run into this sort of thing, and/or have a possible solution?
Thanks.
If you use asset catalogues, could it be, that the asset catalog is not part of your build target? Check it by clicking on the catalogue in the project explorer and inspecting the targets in the inspector window.
I am developing an Adobe Air app. I need to set an icon to the app so it is shown on the task bar. I added the icon tag to the descriptor file but it is not working and I really don't know why, any ideas?
Two things that might be throwing you off:
1) the icons block is commented out by default in the auto-generated descriptor file, and is an easy thing to overlook
2) the icons specified in a descriptor file don't appear in the app unless you build a release build, and install the resulting .air file. A debug build will only show the AIR icon.
At least these are the behaviors I experience in Flash Builder 4.
Adding the icons to your application descriptor should do it.
However, icons come in different sizes.
For example:
<icon>
<image16x16>/icons/app/icon_16.png</image16x16>
<image29x29>/icons/app/icon_29.png</image29x29>
<image32x32>/icons/app/icon_32.png</image32x32>
<image36x36>/icons/app/icon_36.png</image36x36>
<image48x48>/icons/app/icon_48.png</image48x48>
<image57x57>/icons/app/icon_57.png</image57x57>
<image72x72>/icons/app/icon_72.png</image72x72>
<image114x114>/icons/app/icon_114.png</image114x114>
<image128x128>/icons/app/icon_128.png</image128x128>
<image512x512>/icons/app/icon_512.png</image512x512>
</icon>
If I'm not mistaken, the 32x32 icon should be the one that is displayed in the taskbar.
Obviously, make sure that you are referring to the correct path in your descriptor file.
One more thing. I just wasted over an hour on this: For an iOS app, you won't see the icon when you drop the app into iTunes (at least not under Windows), but it will appear on your device!