Hello!

There are two widgets - parent (main window) and child (pop-up menu):
Qt Code:
  1. from PyQt5.QtCore import *
  2. from PyQt5.QtGui import *
  3. from PyQt5.QtWidgets import *
  4.  
  5. class Window(QWidget):
  6. def __init__(self):
  7. QWidget.__init__(self)
  8. self.menu = Menu(parent=self)
  9. self.menu.hide()
  10. ...
  11.  
  12. class Menu(QWidget):
  13. def __init__(self, parent):
  14. QWidget.__init__(self, parent)
  15. ...
To copy to clipboard, switch view to plain text mode 


By default, menu is hidden. The menu should be shown when touch on the main window area. This task is easily solved with QEvent.TouchBegin:
Qt Code:
  1. def eventFilter(self, obj, event):
  2. if event.type() == QEvent.TouchBegin: self.menu.show()
To copy to clipboard, switch view to plain text mode 

The menu should become hidden when touch on any area of the main window that doesn't have a menu above it (a touch outside the menu).

Is there an easy way to detect this event (without using touch coordinates)?