Beispiel #1
0
 def handle_tap_hold(self, action, tp):
     etype = {'start':QEvent.MouseButtonPress, 'update':QEvent.MouseMove, 'end':QEvent.MouseButtonRelease}[action]
     ev = QMouseEvent(etype, self.current_position(tp), tp.current_screen_position.toPoint(), Qt.LeftButton, Qt.LeftButton, Qt.NoModifier)
     QApplication.sendEvent(self.parent(), ev)
     if action == 'end':
         ev = QContextMenuEvent(QContextMenuEvent.Other, self.current_position(tp), tp.current_screen_position.toPoint())
         # We have to use post event otherwise the popup remains an alien widget and does not receive events
         QApplication.postEvent(self.parent(), ev)
Beispiel #2
0
 def handle_tap_hold(self, action, tp):
     etype = {'start':QEvent.MouseButtonPress, 'update':QEvent.MouseMove, 'end':QEvent.MouseButtonRelease}[action]
     ev = QMouseEvent(etype, self.current_position(tp), tp.current_screen_position.toPoint(), Qt.LeftButton, Qt.LeftButton, Qt.NoModifier)
     QApplication.sendEvent(self.parent(), ev)
     if action == 'end':
         ev = QContextMenuEvent(QContextMenuEvent.Other, self.current_position(tp), tp.current_screen_position.toPoint())
         # We have to use post event otherwise the popup remains an alien widget and does not receive events
         QApplication.postEvent(self.parent(), ev)
Beispiel #3
0
def send_click(view, pos, button=Qt.LeftButton, double_click=False):
    if double_click:
        ev = QMouseEvent(QEvent.MouseButtonDblClick, pos, button, button, QApplication.keyboardModifiers())
        QApplication.postEvent(view.viewport(), ev)
        return
    ev = QMouseEvent(QEvent.MouseButtonPress, pos, button, button, QApplication.keyboardModifiers())
    QApplication.postEvent(view.viewport(), ev)
    ev = QMouseEvent(QEvent.MouseButtonRelease, pos, button, button, QApplication.keyboardModifiers())
    QApplication.postEvent(view.viewport(), ev)
Beispiel #4
0
def send_click(view, pos, button=Qt.MouseButton.LeftButton, double_click=False):
    mods = QApplication.keyboardModifiers()
    if double_click:
        ev = QMouseEvent(QEvent.Type.MouseButtonDblClick, pos, button, button, mods)
        QApplication.postEvent(view.viewport(), ev)
        return
    ev = QMouseEvent(QEvent.Type.MouseButtonPress, pos, button, button, mods)
    QApplication.postEvent(view.viewport(), ev)
    ev = QMouseEvent(QEvent.Type.MouseButtonRelease, pos, button, button, mods)
    QApplication.postEvent(view.viewport(), ev)
Beispiel #5
0
 def run(self):
     while True:
         callback = idle_loop.get()
         if callback is None:
             break
         QApplication.postEvent(self.parent, _Event(callback))
Beispiel #6
0
 def m_event(_event, _pos):
     e = QMouseEvent(_event, QPoint(_pos), w.mapToGlobal(_pos),
                     Qt.LeftButton, Qt.LeftButton, Qt.NoModifier)
     QApplication.postEvent(w, e)