The #ifdef can of course be adjusted to target all needed platforms, or omitted to force the same icons on all platforms including Linux.Īs a result, this approach avoids all laborious coding and the result is consistent with the system icons at least on Linux. NO NEED FOR ui->action_Open->setIcon(.) MainWindow::MainWindow(QWidget *parent) : That frees you from the ui->action_Open->setIcon(.) coding.Īnd the final tweak is to set the theme before ui setup. That's the native look (icons will be configurable in your system settings). For those developing under Linux, system icons will show right in the Designer (suppose the iconset uses standard icon names). Now, using the "Theme" property, you can define the icons in the Qt Designer, as already shown in the question. One can use this script to any iconset - first laborious step is solved. The generated file contained absolute paths, but that's easy to Find&Replace. Download icons in all formats or edit them for your designs. These free images are pixel perfect to fit your design and available in both PNG and vector. I just had to change the arguments of subprocess.check_call() from '-binary' and '-compress' to '-binary' and '-compress'. Get free Tango icons in iOS, Material, Windows and other design styles for web, mobile, and graphic design projects. But mainly, it brings a Python script generate_rcc.py, which can generate the *.qrc file automatically. Repository already features the index.theme file. I've cloned the Tango iconset from github. Here I suggest improvements to get rid of the Cons. The author states three Pros ( Available to all platforms, Excellent resizing, Covers all needed icons), and two Cons ( Not consistent with system icon theme, Pain in the ass to implement). This is a temporary function to replace Tango icons across Jenkins and plugins with appropriate. I favorite the last one - Creating a custom icon theme. ![]() You can find a very good explanation on how to do it here: Solution suggested a great link with multiple approaches to solve the problem. If you target both Linux/X11 and other platforms, with this solution you get the native icons on one system and the icons you provide yourself on the others. If you only target the Windows platform, the theme setting will be of no use for you. You can leverage icons from sets available in the public domain, e.g. Then you have to provide icons of the same Alias under Prefix ":/icons" in your resources. The solution to this problem is to set the theme name in QtCreator (as in your example). On Windows and OS X, you have to provide your own icons. Theme icons are only supported on Linux/X11.
0 Comments
Leave a Reply. |