How to set the focus fixed for a particular Widget
-
I have a QWidget (Widget_X). In Widget_X am using few QLineEdits in it. Whenever i press on the QLineEdit a new QWidget (Widget_Y) pops up. In Widget Y , i have few QPushButtons in it. _ whenever the QLineEdit is pressed the Focus will be changed to the new widget (Widget_Y). But, i want the focus to be in Widget_X always (Always Widget_X has to be active ). Even when am pressing the QPushButtons from Widget_Y, still the focus has to be in Widget_X, but the click event of Widget_Y should also be accepted. Please help me on how to achieve this.
-
Hi...
I hope that the below given code will help you to fix your problem.@bool yourWidget::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;
}@