在回答 Get HWND on windows with Qt5 (from WId)中,建议使用 QPlatformNativeInterface 来恢复本机窗口句柄。
为了访问QT头文件,该示例使用了完整路径:
#include <QtGui/5.0.0/QtGui/qpa/qplatformnativeinterface.h>
当然,这并不是一个明确的解决方案,有没有一种方法可以使用QT的默认包含系统来包含QPlatformNativeInterface?
请注意,以上两种情况都不可行。
#include <QPlatformNativeInterface>
工作(此文件不在默认QT构建过程中生成)
也不
#include <QGuiApplication>
作品(其中仅包含 QPlatformNativeInterface 的前向声明)