为什么 QChar( Qt::Key_Right ) 现在出现段错误?

发布于 2025-01-15 06:23:21 字数 654 浏览 2 评论 0原文

我正在更新一个名为 QFakeVim 的项目中的一些旧内容,它将键盘输入作为整数,然后根据该整数返回 QChar。除了这段代码曾经是有效的这一事实之外,这并不是特别重要。但我不确定自 Qt6 以来 QChar 发生了什么变化。

要复制该错误,只需要这一行代码:

QChar( Qt::key_Right );

正在调用这行代码:

constexpr QCHAR_MAYBE_IMPLICIT QChar(int rc) noexcept : QChar(uint(rc)) {}
// which calls:
constexpr QCHAR_MAYBE_IMPLICIT QChar(uint rc) noexcept : ucs((Q_ASSERT(rc <= 0xffff), char16_t(rc))) {}

哪一行失败了:

Q_ASSERT(rc <= 0xffff)

Qt6 对此有什么改变吗?为什么要在这里Q_ASSERT?谢谢。

I am updating some old cold from a project known as QFakeVim, and it is taking keyboard inputs as integers, and then returning QChar's based on that integer. That is not particularly important other than the fact that this code used to be functional. I am not sure however what has changed since Qt6 in regards to QChar.

To replicate the bug, one merely needs this line of code:

QChar( Qt::key_Right );

which is calling this line of code:

constexpr QCHAR_MAYBE_IMPLICIT QChar(int rc) noexcept : QChar(uint(rc)) {}
// which calls:
constexpr QCHAR_MAYBE_IMPLICIT QChar(uint rc) noexcept : ucs((Q_ASSERT(rc <= 0xffff), char16_t(rc))) {}

Which is failing this:

Q_ASSERT(rc <= 0xffff)

Did something change in Qt6 regarding this? Why does it wish to Q_ASSERT here? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文