Following on from the previous post... I need to forward events from the transparent window to my Qt Quick Widget. I am currently using the following:
bool TransparentWidget::event(QEvent *event)
{
switch (event->type())
{
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseButtonDblClick:
case QEvent::MouseMove:
// QMouseEvent
event->ignore();
event->setAccepted(false);
((MyQuickWidget*)parentWidget())->event(event);
((MyQuickWidget*)parentWidget())->setEnabled(true);
break;
default:
break;
}
return QWidget::event(event);
}
This works but the positions are relative to the transparent window. Not sure if this is going to be a problem but if it is than I can use mapToParent and create a new mouse event.
bool TransparentWidget::event(QEvent *event)
{
switch (event->type())
{
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseButtonDblClick:
case QEvent::MouseMove:
// QMouseEvent
event->ignore();
event->setAccepted(false);
((MyQuickWidget*)parentWidget())->event(event);
((MyQuickWidget*)parentWidget())->setEnabled(true);
break;
default:
break;
}
return QWidget::event(event);
}
This works but the positions are relative to the transparent window. Not sure if this is going to be a problem but if it is than I can use mapToParent and create a new mouse event.
Comments
Post a Comment