16,223
社区成员
// since multiple Qt versions can be used in one process
// each one has to have window class names with a unique name
// The first instance gets the unmodified name; if the class
// has already been registered by another instance of Qt then // add a UUID. The check needs to be performed for each name
// in case new message windows are added (QTBUG-81347).
qwindowscontext的registerWindowClass的注释明确表示可以在一个进程中使用多个版本的qt,但是实际上并非如此,在源码中有一个用于判断窗口类是否被注册的代码并没有生效:
const auto appInstance = static_cast<HINSTANCE>(GetModuleHandle(nullptr));
WNDCLASS wcinfo;
const bool classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo) == TRUE && wcinfo.lpfnWndProc != proc;
if (classExists)
cname += QUuid::createUuid().toString();
导致窗口类重名并没有正确判断出,导致窗口类名重复注册(但是第二个注册的时候失败了)。最终导致的结果就是后续使用的qt版本开发的qt界面打开后白屏,无法正常显示。该如何解决这个问题呢。
难不成要下载与各个版本WPS匹配的WPS Com插件?
两个Qt版本不是同一个大版本不会有这个问题(比如一个是Qt4的版本、一个是Qt5的版本,窗口类注册的名称本身就不同),但是如果都使用qt5的版本就会出现上述问题。是在开发用Qt开发WPS com插件,WPS本身会使用Qt,然而各个版本的WPS会使用不同的Qt版本,开发插件的版本是Qt5版本,和WPS某些版本就会出现兼容问题。
使用最低的各个高版本都可兼容的Qt版本?