尽管在资源中有效(并在其他地方使用),但 WindowIcon 未显示
在我的上一个问题中(Qt/C++:图标未显示当程序运行时)我询问如何让图标显示在工具栏上,并被告知我需要一个 Qt 资源,我添加了该资源并解决了我的问题,图标确实显示在工具栏上。
现在我尝试使用相同的资源文件设置窗口的标题图标,它在 Qt 预览查看器中显示良好,但在实际程序中显示为空白。我正在使用一个具有 MDIArea 的 MainWindow,并且子窗口也是 MainWindows;父 MDI 和子 MDI 窗口图标都无法正确显示。在父级上,我看到常规的“Windows 应用程序图标”,而在子级上,该图标完全空白。
我该如何解决这个问题?
In my last question (Qt/C++: Icons not showing up when program is run) I asked how to get an icon to show up on a toolbar and was told I needed a Qt Resource, which I added and that fixed my problem, the icon did show up on the toolbar.
Now I'm trying to set the title icon of a window, using the same resource file, and it shows up fine in the Qt preview viewer but blank in the actual program. I am using a MainWindow which has an MDIArea and the children are MainWindows as well; neither the parent MDI nor child MDI windows icons will show properly. On the parent, I see the regular "Windows Application icon" and on the child, the icon is completely blank.
How can I solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须浏览 Windows 的标准资源文件。 (即 .rc)
流程(如文档中所述) 是:
在 Visual Studio 中,您只需将资源添加到项目中即可。
You will have to go through a standard resource file for windows. (That is, a .rc)
The process (as described in the documentation) is:
In the Visual Studio case you're simply able to add a resource to your project.