[Interest] How to pass key-press/mouse-wheel events to underlying window after QWidget::createWindowContainer()

Sze Howe Koh szehowe.koh at gmail.com
Wed Jul 16 02:20:51 CEST 2014


Hello,

I'm on Windows 8.1 ×64. I got a HWND from an external process
(Notepad.exe, in this case) and embedded it inside a QWidget:

// Get the HWND using Windows API
WId id = (WId)FindWindow(NULL, L"Untitled - Notepad");

// Embed the window in a widget
QWindow* window = QWindow::fromWinId(id);
QWidget* widget = QWidget::createWindowContainer(window);
widget->show();


The embedded Notepad can receive mouse clicks and drags -- I can use
the mouse to highlight text, and use the right-click menu to
copy+paste text. However,, it doesn’t respond to mouse wheels and key
presses. Does anyone know how I can restore these events?

I got the same results from both MinGW 4.8.2 and MSVC 2013 (both Qt 5.3.1).


Thanks in advance!

Regards,
Sze-Howe



More information about the Interest mailing list