一、class QDateTime’ has no member named ‘toTime_t’
QDateTime类中的toTime_t成员,在QT6中被toMSecsSinceEpoch替代了,直接换过来就行。
二、class QListWidgetltem’ has no member named 'setTextColor’
还没有好的解决办法,直接注释掉。
三、cannot convert bool’ to ‘QWidget*’
在setItemHidden直接改成setItemWidget之后,弹出的错误,还未解决(后续更新)
四、QRegExp’ was not declared in this scope
用QRegularExpression替代QRegExp,
QRegularExpressionValidator替换QRegExpValidator。
五、expected type-specifier before ‘QlntValidator’
还未解决(后续更新)
六、class StyleOption’ has no member named init
QStyleOption的init改成了initFrom。
七、QString 与QByteArray的转换与报错处理
跳转这个文章https://zhuanlan.zhihu.com/p/611600761
八、QDesktopWidget’ was not declared in this scope
QApplication::desktop()不用了, 换成了 QApplication::primaryScreen()。
更全的QT6升级吐血经验总结
https://www.qter.org/forum.php?mod=viewthread&tid=21960