Qt5.13 使用时发现的情况

Kshine2017 2019-10-17 04:22:32
之前一直用的是qt5.9.1,正常使用,基本没有什么问题。编写完一个小项目后,想要给应用程序图标变一变。
于是请教网上的各个大神的方法,得到了基本思路。如下:
win32:RC_FILE += ico.rc
或者
RC_ICONS = ico.ico

但是无论我怎么尝试,编译的时候始终报错。我在翻阅各种大神经验的时候,注意到了有个人说可能是因为版本问题。

又于是,我果断换了个版本直接下载目前最新的开发工具qt 5.13。下载地址:
http://download.qt.io/archive/qt/

安装完成后,打开工程,编译通过,果然是工具的问题。


然而换用新版本,也让我发现了新的问题:
(1)release文件中的exe,不能直接运行,需要windeployqt之后才可以。
(2)release编译,程序运行,串口不能正常工作。串口收不到数据,发送也只能在刚connect之后,才可以发送一次。我打开之前用低版本编译发布后的程序,串口正常工作。由此推断,qt5.13对串口的支持不是很好。这样严重影响了我的调试。(不可能改一点,就windeploqt的)。


于是我决定再换一个版本,选用Qt 5.9.8版本。该版本,对于程序图标改变,和串口功能都是可以正常支持的。

突然想到发个帖子,留给他人做参考。如果各位大佬知道问题的根本原因,希望可以告知。
...全文
625 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
donwmufromdying 2020-01-06
  • 打赏
  • 举报
回复
progress_yt 2019-12-31
  • 打赏
  • 举报
回复
已经修复了
Kshine2017 2019-10-31
  • 打赏
  • 举报
回复
引用 5 楼 满桌烟灰 的回复:
ico.ico放在什么地方?
代码的pro文件旁边,不需要放到release文件夹里
走好每一步 2019-10-31
  • 打赏
  • 举报
回复
记得之前也有一位坛友提过 Qt5.13串口有问题, 可以用第三方库的CSerialPort
Kshine2017 2019-10-31
  • 打赏
  • 举报
回复
引用 7 楼 满桌烟灰 的回复:
Qt 5.13.1版本,QSerialPort不能产生readyRead信号,这是一个BUG,Qt 5.12.5也有同样的问题
原来如此
满桌烟灰 2019-10-31
  • 打赏
  • 举报
回复
Qt 5.13.1版本,QSerialPort不能产生readyRead信号,这是一个BUG,Qt 5.12.5也有同样的问题
满桌烟灰 2019-10-24
  • 打赏
  • 举报
回复
ico.ico放在什么地方?
donwmufromdying 2019-10-21
  • 打赏
  • 举报
回复
RC_ICONS Windows only. Specifies the icons that should be included into a generated .rc file. This is only utilized if the RC_FILE and RES_FILE variable are not set. More details about the generation of .rc files can be found in the Platform Notes. 这是Qt5.12.5版本说明。RC_ICONS和RC_FILE或者RES_FILE不能同时都设置。 下边是如何添加.rc Adding Windows Resource Files This section describes how to handle a Windows resource file with qmake to have it linked to an application executable (EXE) or dynamic link library (DLL). qmake can optionally auto-generate a suitably filled Windows resource file. A linked Windows resource file may contain many elements that can be accessed by its EXE or DLL. However, the Qt resource system should be used for accessing linked-in resources in a platform-independent way. But some standard elements of the linked Windows resource file are accessed by Windows itself. For example, in Windows explorer the version tab of the file properties is filled by resource elements. In addition, the program icon of the EXE is read from these elements. So it is good practice for a Qt created Windows EXE or DLL to use both techniques at the same time: link platform-independent resources via the Qt resource system and add Windows specific resources via a Windows resource file. Typically, a resource-definition script (.rc file) is compiled to a Windows resource file. Within the Microsoft toolchain, the RC tool generates a .res file, which can be linked with the Microsoft linker to an EXE or DLL. The MinGW toolchain uses the windres tool to generate an .o file that can be linked with the MinGW linker to an EXE or DLL. The optional auto-generation of a suitably filled .rc file by qmake is triggered by setting at least one of the system variables VERSION and RC_ICONS. The generated .rc file is automatically compiled and linked. Elements that are added to the .rc file are defined by the system variables QMAKE_TARGET_COMPANY, QMAKE_TARGET_DESCRIPTION, QMAKE_TARGET_COPYRIGHT, QMAKE_TARGET_PRODUCT, RC_CODEPAGE, RC_ICONS, RC_LANG,and VERSION. If these elements are not sufficient, qmake has the two system variables RC_FILE and RES_FILE that point directly to an externally created .rc or .res file. By setting one of these variables, the specified file is linked to the EXE or DLL. Note: The generation of the .rc file by qmake is blocked, if RC_FILE or RES_FILE is set. In this case, no further changes are made to the given .rc file or the .res or .o file by qmake; the variables pertaining to .rc file generation have no effect.
Kshine2017 2019-10-17
  • 打赏
  • 举报
回复
引用 2 楼 今天也要元气满满哦 的回复:
一般开发的时候就在qt里面直接运行,到最后打包软件的时候才用windeployqt一下找齐需要的库文件; 想问一下编译报错是因为加了RC_ICONS = ico.ico这句话吗?如果这句有问题你的工程应该都不能正常加载了吧,我用的还是qt5.4呢,可以正常加载图标啊
是的,添加这句话会报错,去掉就可以正常编译。换成其他版本,这个问题消失。
  • 打赏
  • 举报
回复
一般开发的时候就在qt里面直接运行,到最后打包软件的时候才用windeployqt一下找齐需要的库文件; 想问一下编译报错是因为加了RC_ICONS = ico.ico这句话吗?如果这句有问题你的工程应该都不能正常加载了吧,我用的还是qt5.4呢,可以正常加载图标啊
Kshine2017 2019-10-17
  • 打赏
  • 举报
回复
自己回复一下自己,缓解一下尴尬的气氛

16,213

社区成员

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

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