简体   繁体   中英

Embedding another Window as a QWidget

I'm currently working on a project that uses Allegro for rendering, input, etc. However I would like to add a GUI to my project using something like Qt. The problem is that Allegro does not support using a Window not created by allegro for rendering/input, it needs to create the window itself. I was thinking of using Qt to make the UI, and then creating a window normally using allegro, and then somehow embedding the allegro window into the Qt application.

Allegro provides the HWND handle to the window its using. Is there anyway to embed the allegro window into a Qt ui using its HWND handle?

You need the QWinHost class from the Qt/MFC Migration Framework. The code is 3-clause BSD licensed. You only need two files: qwinhost.h and qwinhost.cpp , available here .

It does exactly what you need, and works on both Qt 4 and 5.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM