Problem with the Focus of the Widget in Touch screen
-
Hi..
I have a QWidget which contains some Line Edits. I have to pop up a new Numpad widget when the Line edit get the the focus. When i click on the Numpad widget, the focus has to be remained in the Line edit widget. So i tried using
@bool NumPadWidget::nativeEvent(const QByteArray &eventType, void *message, long *result)
{
#ifdef Q_OS_WIN
if(eventType == "windows_generic_MSG")
{
const MSG *msg = reinterpret_cast<MSG *>(message);
if(msg->message == WM_MOUSEACTIVATE)
{
*result = MA_NOACTIVATE;
return true;
}
}
#endif
return false;
}@This is working fine for Mouse clicks of the numpad widget, but i am using a Touch screen. when i touch the Numpad widget, there is a flickering ( title bar flashing effect) on the LineEdit widget. So can anyone please tell me which Macro i have to use to block the focus of the widget on the touch screen.
I tried using WM_Touch macro which results in no proper output. Please help...
-
When I try this below code, it solves the issue, But now it is not working for the Mouse Clicks. But, I want the widget to handle both the Touch and the Mouse Clicks. So Can anyone please tell me the macro which is used to handle both the touch and the Mouse clicks.
@bool NumPadWidget::nativeEvent(const QByteArray &eventType, void *message, long *result)
{
#ifdef Q_OS_WIN
if(eventType == "windows_generic_MSG")
{
const MSG *msg = reinterpret_cast<MSG *>(message);
if(msg->message == WM_MOUSEACTIVATE)
{
*result = MA_NOACTIVATEANDEAT;;
return true;
}
}
#endif
return false;
}@From the Documentation,
MA_ACTIVATE Activates the window, and does not discard the mouse message.
MA_ACTIVATEANDEAT Activates the window, and discards the mouse message.
MA_NOACTIVATE Does not activate the window, and does not discard the mouse message.
MA_NOACTIVATEANDEAT Does not activate the window, but discards the mouse message.When i tried using MA_NOACTIVATE, the focus problem (LineEdit Widget TitleBar shows that the widget is curently inactive) exists.