Details about Icon Groups - icons

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.

Related

PyInstaller attaches 2 icons to exe

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.

How do "theme" icons work in Qt Creator Designer?

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.

Eclipse 4 RCP Vogel tutorial. No toolbar icon

OS X 10.7.5, Eclipse 4.3 Kepler build ID 20130919-0819, Java 1.7.0_51
I'm following along the Vogel tutorial, and I have (another) problem. I've added a toolbar as described in the tutorial, but no icons appear on the toolbar. The toolbar itself appears, but it is empty. If I click in the empty space where the icon should be, the handler is called as expected. I can add an icon file to my project, and have my HandledToolItem point to it, and in that case the icon is visible, and operates as expected.
Should I expect default icons to appear automatically? Do I have to import or include standard Eclipse icons somehow? Or do I have to add each icon manually (I rather doubt this is the case.)
Thanks, gary
You can add Icons via the platform-notation, e.g. platform:/plugin/de.myplugin.ui/icons/icon.gif.
Using this way, you can also access eclipse-build-in-icons.
See this blogpost: http://codeandme.blogspot.co.at/2012/07/reusing-platform-images.html for a plugin to browse the available plugins.

iOS 7 app icon sizes not being recognized

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.

"Office 2010 Add-In: Icons Gallery" - How to extract icons from backstage tab (docx)

I downloaded "Office 2010 Add-In: Icons Gallery" that is docx file with two backstage tabs that hold icons.
How can I extract the icons or use them in my application?
I use ImageMso quite frequently in my Excel development. Having stumbled on another post, I took it a step further and put a package together to visually search, extract and save icons from Microsoft Excel as a file or copy and paste (with alpha channel transparency) to another application. I also compiled a list of 8,899 distinct ImageMso names from the various sources. I hope others can find this useful.
Microsoft Office Icons (ImageMSO) Gallery & Extraction
I suppose the first answer meant to say, that the icons are only meant to be used within Office; that is with Office add-ins and such.
They can be referred with Office Fluent UI definition XML for example. So the distribution form serves as visible "Ahh I want that icon in my add-in" reaction and then choosing the specified ID to use in "imageMso" attribute.
Like this (see proper full XML in Office Fluent UI customization)
<button id="Button1" imageMso="HappyFace" size="" label="Large Button Face" onAction="HandleOnAction" />
This article contains code that worked for me. They even linked the outputted icon sets in transparent PNGs in the article too, so that you don't need to run the code. I've copied the transparent PNG's links from the article below.
Images 1
Images 2
Note:
Although the icons had a transparent background only the image within the icon was transparent, I had to go into Photoshop and remove the white background manually at the top and bottom. Here's an example:
Go to tab "File"
On the left panel you'll see list of backstage tabs
From this post, there are 2 download links for all ImageMso of Office 2010/2013. There is also source code so that we can extract Icons ourselves with different size.
This is an old question, but I miss an "how to use" not "how to view" answer.
In Visual Studio 2015 you can just assign the name (or ID - shown in the docx File right below the pictures) to the "OfficeImageId" Property. This Property is for example available in Microsoft.Office.Tools.Ribbon.RibbonEditBox or .RibbonButton.

Resources