My app have a QLineEdit
and a QPushButton
which not respond properly to inputs of keyboard and mouse (the QLineEdit
is not receiving the keyboard inputs, and both the QLineEdit
and QPushButton
are not receiving mouse inputs) when my app is handling these Windows Events:
bool MainWindow::winEvent(MSG *msg, long *result)
{
HWND hWnd = msg->hwnd;
UINT message = msg->message;
WPARAM wParam = msg->wParam;
LPARAM lParam = msg->lParam;
bool retval = true;
LRESULT lRet = 0;
switch(message)
{
case WM_PAINT:
{
HDC hDC = GetWindowDC(hWnd);
PaintCustomCaption(hWnd, hDC); //Method responsible to draw the image at the non client area
DeleteDC(hDC);
break;
}
case WM_NCHITTEST:
{
lRet = HitTestNCA(hWnd, lParam); //Method responsible to deal with the window resizing and moving
DwmDefWindowProc(hWnd, message, wParam, lParam, &lRet);
break;
}
case WM_NCCALCSIZE:
{
break;
}
default:
{
retval = false;
DwmDefWindowProc(hWnd, message, wParam, lParam, &lRet);
break;
}
}
*result = lRet;
if(retval) return true;
return QWidget::winEvent(msg, result);
}
If I remove such code, my Qt widgets works properly, but I need these codes because my app is drawing an image at the non client area of my window.
Is possible to handle the Windows Events listed above keeping my Qt widgets responsive to keyboard and mouse?