Qt Quick 应用程序的图标和窗口图标设置

shijie_1994 2016-11-24 11:08:51
通过不断的努力,终于用qt quick开发出了qml和C++混合编程的程序,其他一切正常,就是有一个问题,怎么给自己的应用程序以及程序窗口设置图标呢?系统默认的好难看,有没有大神指点下
...全文
3113 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
刚好我也玩过,windows下的是rc文件的ico,我虚拟机是ubuntu图标要自己写.desktop文件,百度一下一大堆,android就是AndroidManifest.xml打开有设置大中小图标的地方
CompierS 2018-01-17
  • 打赏
  • 举报
回复
遇到同样的问题求解
爱伦卡卡西 2017-01-16
  • 打赏
  • 举报
回复
Qt 5.7 Setting the Application Icon Qt 5.7.0 Reference Documentation Contents Setting the Application Icon on Windows Setting the Application Icon on OS X Setting the Application Icon on Common Linux Desktops K Desktop Environment (KDE) GNOME Setting the Application Icon The application icon, typically displayed in the top-left corner of an application's top-level windows, is set by calling the QWindow::setIcon() method. In order to change the icon of the executable application file itself, as it is presented on the desktop (i.e., prior to application execution), it is necessary to employ another, platform-dependent technique. Setting the Application Icon on Windows First, create an ICO format bitmap file that contains the icon image. This can be done with e.g. Microsoft Visual C++: Select File|New, then select the File tab in the dialog that appears, and choose Icon. (Note that you do not need to load your application into Visual C++; here we are only using the icon editor.) Store the ICO file in your application's source code directory, for example, with the name myappico.ico. Then, assuming you are using qmake to generate your makefiles, you only need to add a single line to your .pro project file: RC_ICONS = myappico.ico Finally, regenerate your makefile and your application. The .exe file will now be represented by your icon in Explorer. However, if you already have an .rc file, for example, with the name myapp.rc, which you want to reuse, the following two steps will be required. First, put a single line of text to the myapp.rc file: IDI_ICON1 ICON DISCARDABLE "myappico.ico" Then, add this line to your myapp.pro file: RC_FILE = myapp.rc If you do not use qmake, the necessary steps are: first, create an .rc file and run the rc or windres program on the .rc file, then link your application with the resulting .res file. Setting the Application Icon on OS X The application icon, typically displayed in the application dock area, is set by calling QWindow::setWindowIcon() on a window. It is possible that the program could appear in the application dock area before the function call, in which case a default icon will appear during the bouncing animation. To ensure that the correct icon appears, both when the application is being launched, and in the Finder, it is necessary to employ a platform-dependent technique. Although many programs can create icon files (.icns), the recommended approach is to use the iconutil program supplied by Apple. iconutil is a command-line tool that converts iconset folders to deployment-ready, high-resolution icns files. Using this tool also compresses the resulting icns file, so there is no need for you to perform additional compression. If you are using qmake to generate your makefiles, you only need to add a single line to your .pro project file. For example, if the name of your icon file is myapp.icns, and your project file is myapp.pro, add this line to myapp.pro: ICON = myapp.icns This will ensure that qmake puts your icons in the proper place and creates an Info.plist entry for the icon. If you do not use qmake, you must do the following manually: Create an Info.plist file for your application (using the PropertyListEditor, found in Developer/Applications). Associate your .icns record with the CFBundleIconFile record in the Info.plist file (again, using the PropertyListEditor). Copy the Info.plist file into your application bundle's Contents directory. Copy the .icns file into your application bundle's Contents/Resources directory. Setting the Application Icon on Common Linux Desktops In this section we briefly describe the issues involved in providing icons for applications for two common Linux desktop environments: KDE and GNOME. The core technology used to describe application icons is the same for both desktops, and may also apply to others, but there are details which are specific to each. The main source of information on the standards used by these Linux desktops is freedesktop.org. For information on other Linux desktops please refer to the documentation for the desktops you are interested in. Often, users do not use executable files directly, but instead launch applications by clicking icons on the desktop. These icons are representations of "desktop entry files" that contain a description of the application that includes information about its icon. Both desktop environments are able to retrieve the information in these files, and they use it to generate shortcuts to applications on the desktop, in the start menu, and on the panel. More information about desktop entry files can be found in the Desktop Entry Specification. Although desktop entry files can usefully encapsulate the application's details, we still need to store the icons in the conventional location for each desktop environment. A number of locations for icons are given in the Icon Theme Specification. Although the path used to locate icons depends on the desktop in use, and on its configuration, the directory structure beneath each of these should follow the same pattern: subdirectories are arranged by theme, icon size, and application type. Generally, application icons are added to the hicolor theme, so a square application icon 32 pixels in size would be stored in the hicolor/32x32/apps directory beneath the icon path. K Desktop Environment (KDE) Application icons can be installed for use by all users, or on a per-user basis. A user currently logged into their KDE 4 desktop can discover these locations by using kde4-config, for example, by typing the following in a terminal window: kde4-config --path icon Applications using Qt 5 and KDE Frameworks 5 will find their icons in the list returned by this command: qtpaths --locate-dirs GenericDataLocation icons Typically, the list of colon-separated paths printed to stdout includes the user-specific icon path and the system-wide path. Beneath these directories, it should be possible to locate and install icons according to the conventions described in the Icon Theme Specification. If you are developing exclusively for KDE, you may wish to take advantage of the KDE build system to configure your application. This ensures that your icons are installed in the appropriate locations for KDE. The KDE developer website is at http://techbase.kde.org/. GNOME Application icons are stored within a standard system-wide directory containing architecture-independent files. This location can be determined by using gnome-config, for example by typing the following in a terminal window: gnome-config --datadir The path printed on stdout refers to a location that should contain a directory called pixmaps; the directory structure within the pixmaps directory is described in the Icon Theme Specification. If you are developing exclusively for GNOME, you may wish to use the standard set of GNU Build Tools, also described in the relevant section of the GTK+/Gnome Application Development book. This ensures that your icons are installed in the appropriate locations for GNOME. The GNOME developer website is at http://developer.gnome.org/. © 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.
ghfa365 2017-01-12
  • 打赏
  • 举报
回复
把项目android-build中AndroidManifest.xml文件单独复制到有.pro目录中,编辑该文件,自己修改图标,然后把AndroidManifest.xml加入工程。
为了使更多的Qt初学者能尽快入门Qt,也为了QtQt Creator的快速普及,我们花费大量精力写出了这一系列教程。虽然教程的知识可能很浅显,虽然教程的语言可能不规范,但是它却被数十万网友所认可。我们会将这一系列教程一直写下去,它将涉及Qt的方方面面 一、Qt Creator的安装和hello world程序的编写 二、Qt Creator编写多窗口程序 三、Qt Creator登录对话框 四、Qt Creator添加菜单图标 五、Qt Creator布局管理器的使用 六、Qt Creator实现文本编辑 七、Qt Creator实现文本查找 八、Qt Creator实现状态栏显示 九、Qt Creator中鼠标键盘事件的处理实现自定义鼠标指针 十、Qt Creator中实现定时器和产生随机数 十一、Qt 2D绘图(一)绘制简单图形 十二、Qt 2D绘图(二)渐变填充 十三、Qt 2D绘图(三)绘制文字 十四、Qt 2D绘图(四)绘制路径 十五、Qt 2D绘图(五)显示图片 十六、Qt 2D绘图(六)坐标系统 十七、Qt 2D绘图(七)Qt坐标系统深入 十八、Qt 2D绘图(八)涂鸦板 十九、Qt 2D绘图(九)双缓冲绘图简介 二十、Qt 2D绘图(十)图形视图框架简介 二十一、Qt数据库(一)简介 二十二、Qt数据库(二)添加MySQL数据库驱动插件 二十三、Qt数据库(三)利用QSqlQuery类执行SQL语句(一) 二十四、Qt数据库(四)利用QSqlQuery类执行SQL语句(二) 二十五、Qt数据库(五)QSqlQueryModel 二十六、Qt数据库(六)QSqlTableModel 二十七、Qt数据库(七)QSqlRelationalTableModel 二十八、Qt数据库(八)XML(一) 二十九、Qt数据库(九)XML(二) 三十、Qt数据库(十)XML(三) 三十一、Qt 4.7.0及Qt Creator 2.0 beta版安装全程图解 三十二、第一个Qt Quick程序(QML程序) 三十三、体验QML演示程序 三十四、Qt Quick Designer介绍 三十五、QML组件 三十六、QML项目之Image和BorderImage 三十七、Flipable、Flickable和状态与动画 三十八、QML视图 三十九、QtDeclarative模块 四十、使用Nokia Qt SDK开发Symbian和Maemo终端软件 四十一、Qt网络(一)简介 四十二、Qt网络(二)HTTP编程 四十三、Qt网络(三)FTP(一) 四十四、Qt网络(四)FTP(二) 四十五、Qt网络(五)获取本机网络信息 四十六、Qt网络(六)UDP 四十七、Qt网络(七)TCP(一) 四十八、Qt网络(八)TCP(二)
QT creator 教程 一、Qt Creator的安装和hello world程序的编写 二、Qt Creator编写多窗口程序 三、Qt Creator登录对话框 四、Qt Creator添加菜单图标 五、Qt Creator布局管理器的使用 六、Qt Creator实现文本编辑 七、Qt Creator实现文本查找 八、Qt Creator实现状态栏显示 九、Qt Creator中鼠标键盘事件的处理实现自定义鼠标指针 十、Qt Creator中实现定时器和产生随机数 十一、Qt 2D绘图(一)绘制简单图形 十二、Qt 2D绘图(二)渐变填充 十三、Qt 2D绘图(三)绘制文字 十四、Qt 2D绘图(四)绘制路径 十五、Qt 2D绘图(五)显示图片 十六、Qt 2D绘图(六)坐标系统 十七、Qt 2D绘图(七)Qt坐标系统深入 十八、Qt 2D绘图(八)涂鸦板 十九、 Q t 2D 绘图(九)双缓冲绘图简介 二十、Qt 2D绘图(十)图形视图框架简介 二十一、Qt数据库(一)简介 二十二、Qt数据库(二)添加MySQL数据库驱动插件 二十三、Qt数据库(三)利用QSqlQuery类执行SQL语句(一) 二十四、Qt数据库(四)利用QSqlQuery类执行SQL语句(二) 二十五、Qt数据库(五)QSqlQueryModel 二十六、Qt数据库(六)QSqlTableModel 二十七、Qt数据库(七)QSqlRelationalTableModel 二十八、Qt数据库(八)XML(一) 二十九、Qt数据库(九)XML(二) 三十、Qt数据库(十)XML (三) 三十一、Qt 4.7.0及Qt Creator 2.0 beta版安装全程图解 三十二、第一个Qt Quick程序(QML程序) 三十三、体验QML演示程序 三十四、Qt Quick Designer介绍 三十五、QML 组件 三十六、QML项目之Image和BorderImage 三十七、Flipable、Flickable 和状态与动画 三十八、QML 视图 三十九、QtDeclarative模块 四十、使用Nokia Qt SDK开发Symbian和Maemo终端软件 四十一、Qt网络(一)简介四十二、Qt网络(二)HTTP编程 四十三、Qt网络(三)FTP(一) 四十四、Qt网络(四)FTP(二) 四十五、Qt网络(五)获取本机网络信 四十六、Qt网络(六)UDP 四十七、Qt网络(七)TCP(一) 四十八、Qt网络(八)TCP(二)

16,215

社区成员

发帖
与我相关
我的任务
社区描述
Qt 是一个跨平台应用程序框架。通过使用 Qt,您可以一次性开发应用程序和用户界面,然后将其部署到多个桌面和嵌入式操作系统,而无需重复编写源代码。
社区管理员
  • Qt
  • 亭台六七座
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧