code: def event(self, event):
          
          if event.type() == QtCore.QEvent.WindowDeactivate:  # hide the tooltip
              self.cyatimer.stop()
              self.hide()
              return True
          if event.type() == QtCore.QEvent.Leave:  # start timer
              self.cyatimer.start(self._interval)
              return True
          if event.type() == QtCore.QEvent.Enter:  # reset/stop timer
              self.cyatimer.stop()
              return True
          if event.type() == QtCore.QEvent.Show:  # render the widgets
              self.cyatimer.stop()
              return True
          return super(WidgetToolTip, self).event(event)
docs: Reimplementation of QWidget.event
  
          The widget is closed, when the window is deactivated.
          The widget is closed after the set interval if the mouse leaves the widget.
          The timer is stops when the mouse enters the widget before the interval ends.
          On show, the added widgets are rendered for the tooltip into buttons. The buttons
          are used to set the widget in focus.