'morning,

I have a custom QWidget, myWid, that pops up when the user mouses over a QPushButton. The QWidget pops-up adjacent to (slightly overlapping) this pushButton. I want myWid to remain shown (popped up) as long as the mouse is over either the QPushButton *or* myWid. My eventFilter looks like this:

Qt Code:
  1. bool Window::eventFilter(QObject *obj, QEvent *event)
  2. {
  3. if(event->type() == QEvent::Enter)
  4. {
  5. if(obj == myPB)
  6. {
  7. myWid->show();
  8. return QWidget::eventFilter(obj, event);
  9. }
  10. return QWidget::eventFilter(obj, event);
  11.  
  12. else if(event->type() == QEvent::Leave)
  13. {
  14. if(obj == myPB)
  15. {
  16. if(!myWid->underMouse())
  17. {
  18. myWid->hide();
  19. return QWidget::eventFilter(obj, event);
  20. }
  21. return QWidget::eventFilter(obj, event);
  22. }
  23. return QWidget::eventFilter(obj, event);
  24. }
  25. return QWidget::eventFilter(obj, event);
  26. }
To copy to clipboard, switch view to plain text mode 

the "hide()" above is conditional: if the mouse is over myWid, do not hide() it when Leave myPB. This doesn't work: the panel flickers on/off rapidly or closes when I mouse over it. I understand why this is happening, but I can't figure out an alternative. Suggestions?