QTabWidget 中缺少图标
我正在使用最新的 Qt 4.5,并使用 Qt Creator 创建 GUI。 我的选项卡小部件在创建器中看起来很好,显示了所有图标。 然而,当我编译并运行它时,没有图标,但选项卡比它们更宽,这显然表明了一些东西。 我尝试了 .png 和 .ico 格式,但都不起作用。 图标的大小为 16x16,与最大选项卡图标大小属性完全相同。
除了“clearlooks”的“常规样式”之外,选项卡控件的样式表未应用(也没有任何样式表)。
I'm using the newest Qt 4.5 and I'm creating my GUI with Qt Creator. My tab widget looks fine in the Creator, with all icons displayed. However, when I compile it and run it, there are no icons, but the tabs are wider than they are which indicates something, obviously. I tried both .png and .ico formats, none work. The size of icons is 16x16, exactly as the maximum tab icon size property.
The stylesheet to the tab control is not applied (nor there is any), except the 'general style' which is 'clearlooks'.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我正在用 pyqt 制作一个应用程序。 如果我“编译”它,我需要将 imageformats\qico4.dll 包含在 imageformats 子文件夹中。 希望能帮助到你 :)
im making a app with pyqt. and if i "compile" it i need to include the imageformats\qico4.dll in the imageformats subfolder. hope it helps :)
您的可执行文件可能无法找到您的图标。 尝试使用 Qt 资源系统嵌入它们,这就是它们通常的分布方式。
否则,您需要从运行可执行文件的任何工作目录检查路径是否正确。
Your icons probably can't be found by your executable. Try embedding them using the Qt resource system, this is how they are usually distributed.
Otherwise you need to check your paths are correct from whatever working directory you are running the executable from.
也许您必须将图标放在二进制文件附近? 或者您可以将资源目录放在二进制文件附近。
如果您使用的是 Windows,您可以使用 Filemon 检查是否找到图标?
Maybe you have to put the icons near your binary file? Or you can place your resource directory near your binary file.
If you are using Windows, you can check with Filemon if it finds the icons?