我试图使用小部件的 winId 将来自外星应用程序(python OCC)的显示嵌入到(Py)Qt 中。但是当我将它传递给 OCC 时,我得到一个溢出错误。检查 winId qt 会返回其 4318283408,它大于 32 位数字。我运行 64 位(osx)并且两个库都是为 64 位编译的,但我有一种预感,OCC 仍然只喜欢 32 位数字。所以我的问题是,有没有办法控制 Qt 返回的 winId 的范围?
谢谢
亨里克
Looking in Qt's source code, in the file src/gui/kernel/qwindowdefs.h
, you'll find that WId
is typedef'd to long
for 64-bits OSX (it's int
for 32-bits OSX). A long
on 64-bits OSX is 8 bytes long (or 64 bits), and therefore 4318283408 is a valid value.
If you want to force winId() to return a 32 bits value, you will need to link to a 32-bits version of the Qt's library.