-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Description
Following #11 (comment) brought to my attention that key strokes are not received anymore with the QTBUG-42183 workaround.
QtDirect3D/source/QDirect3D12Widget/QDirect3D12Widget.cpp
Lines 481 to 523 in 91dd31c
| bool QDirect3D12Widget::event(QEvent * event) | |
| { | |
| switch (event->type()) | |
| { | |
| // Workaround for https://bugreports.qt.io/browse/QTBUG-42183 to get key strokes. | |
| // To make sure that we always have focus on the widget when we enter the rect area. | |
| case QEvent::Enter: | |
| case QEvent::FocusIn: | |
| case QEvent::FocusAboutToChange: | |
| if (::GetFocus() != m_hWnd) | |
| { | |
| QWidget * nativeParent = this; | |
| while (true) | |
| { | |
| if (nativeParent->isWindow()) break; | |
| QWidget * parent = nativeParent->nativeParentWidget(); | |
| if (!parent) break; | |
| nativeParent = parent; | |
| } | |
| if (nativeParent && nativeParent != this && | |
| ::GetFocus() == reinterpret_cast<HWND>(nativeParent->winId())) | |
| ::SetFocus(m_hWnd); | |
| } | |
| break; | |
| case QEvent::KeyPress: | |
| emit keyPressed((QKeyEvent *)event); | |
| break; | |
| case QEvent::MouseMove: | |
| emit mouseMoved((QMouseEvent *)event); | |
| break; | |
| case QEvent::MouseButtonPress: | |
| emit mouseClicked((QMouseEvent *)event); | |
| break; | |
| case QEvent::MouseButtonRelease: | |
| emit mouseReleased((QMouseEvent *)event); | |
| break; | |
| } | |
| return QWidget::event(event); | |
| } |
giladreich
Metadata
Metadata
Assignees
Labels
No labels