fix: resolve compilation failure on Qt 6.9

Updated the dvtablehook.h file to adjust the typedef for Fun2ReturnType
based on changes in Qt 6.9 interfaces. Additionally, the main.cpp
file now casts the unicode value to short to prevent type issues.
These changes are necessary to ensure compatibility with the latest
Qt framework and to resolve the build issues that arise from interface
modifications.

修复: 解决在Qt 6.9上的编译失败

更新了dvtablehook.h文件,以根据Qt 6.9接口的变化调整Fun2ReturnType的
typedef。此外,main.cpp文件现在将unicode值转换为short,以防止类型问题。
这些更改对于确保与最新Qt框架兼容以及解决接口修改引起的构建问题是必要的。
This commit is contained in:
JiDe Zhang 2025-04-12 16:41:54 +08:00 committed by zccrs
parent d6dd19e5f6
commit 8db10c9145
2 changed files with 5 additions and 1 deletions

View File

@ -222,7 +222,11 @@ public:
Q_STATIC_ASSERT_X((FunctorArgumentCount >= 0),
"Function1 and Function2 arguments are not compatible.");
const int Fun2ArgumentCount = (FunctorArgumentCount >= 0) ? FunctorArgumentCount : 0;
#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)
typedef typename QtPrivate::FunctorReturnType<Fun2, typename QtPrivate::List_Left<typename FunctionPointer<Fun1>::Arguments, Fun2ArgumentCount>::Value>::type Fun2ReturnType;
#else
typedef typename QtPrivate::FunctorReturnType<Fun2, typename QtPrivate::List_Left<typename FunctionPointer<Fun1>::Arguments, Fun2ArgumentCount>::Value>::Value Fun2ReturnType;
#endif
Q_STATIC_ASSERT_X((QtPrivate::AreArgumentsCompatible<Fun2ReturnType, typename FunInfo1::ReturnType>::value),
"Function1 and Function2 return type are not compatible.");

View File

@ -15,7 +15,7 @@
static QString toUnicodeEscape(const QString& input) {
QString result;
for (QChar ch : input) {
result += QString("\\u%1").arg(ch.unicode(), 4, 16, QChar('0'));
result += QString("\\u%1").arg(static_cast<short>(ch.unicode()), 4, 16, QChar('0'));
}
return result;
}