Python PyQt5.QtCore.Qt.RightButton() Examples
The following are 30
code examples of PyQt5.QtCore.Qt.RightButton().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtCore.Qt
, or try the search function
.
Example #1
Source File: QtImageViewer.py From PyQtImageViewer with MIT License | 6 votes |
def mouseReleaseEvent(self, event): """ Stop mouse pan or zoom mode (apply zoom if valid). """ QGraphicsView.mouseReleaseEvent(self, event) scenePos = self.mapToScene(event.pos()) if event.button() == Qt.LeftButton: self.setDragMode(QGraphicsView.NoDrag) self.leftMouseButtonReleased.emit(scenePos.x(), scenePos.y()) elif event.button() == Qt.RightButton: if self.canZoom: viewBBox = self.zoomStack[-1] if len(self.zoomStack) else self.sceneRect() selectionBBox = self.scene.selectionArea().boundingRect().intersected(viewBBox) self.scene.setSelectionArea(QPainterPath()) # Clear current selection area. if selectionBBox.isValid() and (selectionBBox != viewBBox): self.zoomStack.append(selectionBBox) self.updateViewer() self.setDragMode(QGraphicsView.NoDrag) self.rightMouseButtonReleased.emit(scenePos.x(), scenePos.y())
Example #2
Source File: QVTKRenderWindowInteractor.py From Det3D with Apache License 2.0 | 6 votes |
def mousePressEvent(self, ev): ctrl, shift = self._GetCtrlShift(ev) repeat = 0 if ev.type() == QEvent.MouseButtonDblClick: repeat = 1 self._Iren.SetEventInformationFlipY( ev.x(), ev.y(), ctrl, shift, chr(0), repeat, None ) self._ActiveButton = ev.button() if self._ActiveButton == Qt.LeftButton: self._Iren.LeftButtonPressEvent() elif self._ActiveButton == Qt.RightButton: self._Iren.RightButtonPressEvent() elif self._ActiveButton == Qt.MidButton: self._Iren.MiddleButtonPressEvent()
Example #3
Source File: quickplotter.py From phidl with MIT License | 6 votes |
def mousePressEvent(self, event): super(QGraphicsView, self).mousePressEvent(event) #============================================================================== # Zoom to rectangle, from # https://wiki.python.org/moin/PyQt/Selecting%20a%20region%20of%20a%20widget #============================================================================== if event.button() == Qt.RightButton: self._mousePressed = Qt.RightButton self._rb_origin = QPoint(event.pos()) self.rubberBand.setGeometry(QRect(self._rb_origin, QSize())) self.rubberBand.show() #============================================================================== # Mouse panning, taken from # http://stackoverflow.com/a/15043279 #============================================================================== elif event.button() == Qt.MidButton: self._mousePressed = Qt.MidButton self._mousePressedPos = event.pos() self.setCursor(QtCore.Qt.ClosedHandCursor) self._dragPos = event.pos()
Example #4
Source File: quickplotter.py From phidl with MIT License | 6 votes |
def mouseMoveEvent(self, event): super(QGraphicsView, self).mouseMoveEvent(event) # # Useful debug # try: # self.debug_label.setText(str(itemsBoundingRect_nogrid().width())) # except: # print('Debug statement failed') # Update the X,Y label indicating where the mouse is on the geometry mouse_position = self.mapToScene(event.pos()) self.mouse_position = [mouse_position.x(), mouse_position.y()] self.update_mouse_position_label() if not self._rb_origin.isNull() and self._mousePressed == Qt.RightButton: self.rubberBand.setGeometry(QRect(self._rb_origin, event.pos()).normalized()) # Middle-click-to-pan if self._mousePressed == Qt.MidButton: newPos = event.pos() diff = newPos - self._dragPos self._dragPos = newPos self.horizontalScrollBar().setValue(self.horizontalScrollBar().value() - diff.x()) self.verticalScrollBar().setValue(self.verticalScrollBar().value() - diff.y()) # event.accept()
Example #5
Source File: quickplotter.py From phidl with MIT License | 6 votes |
def mouseReleaseEvent(self, event): if event.button() == Qt.RightButton: self.rubberBand.hide() rb_rect = QRect(self._rb_origin, event.pos()) rb_center = rb_rect.center() rb_size = rb_rect.size() if abs(rb_size.width()) > 3 and abs(rb_size.height()) > 3: viewport_size = self.viewport().geometry().size() zoom_factor_x = abs(viewport_size.width() / rb_size.width()) zoom_factor_y = abs(viewport_size.height() / rb_size.height()) new_center = self.mapToScene(rb_center) zoom_factor = min(zoom_factor_x, zoom_factor_y) self.zoom_view(zoom_factor) self.centerOn(new_center) self.update_grid() if event.button() == Qt.MidButton: self.setCursor(Qt.ArrowCursor) self._mousePressed = None self.update_grid()
Example #6
Source File: QVTKRenderWindowInteractor.py From pyCGNS with GNU Lesser General Public License v2.1 | 6 votes |
def mousePressEvent(self, ev): ctrl, shift = self._GetCtrlShift(ev) repeat = 0 if ev.type() == QEvent.MouseButtonDblClick: repeat = 1 self._Iren.SetEventInformationFlipY(ev.x(), ev.y(), ctrl, shift, chr(0), repeat, None) self._ActiveButton = ev.button() if self._ActiveButton == Qt.LeftButton: self._Iren.LeftButtonPressEvent() elif self._ActiveButton == Qt.RightButton: self._Iren.RightButtonPressEvent() elif self._ActiveButton == Qt.MidButton: self._Iren.MiddleButtonPressEvent()
Example #7
Source File: paint.py From 15-minute-apps with MIT License | 6 votes |
def text_mousePressEvent(self, e): if e.button() == Qt.LeftButton and self.current_pos is None: self.current_pos = e.pos() self.current_text = "" self.timer_event = self.text_timerEvent elif e.button() == Qt.LeftButton: self.timer_cleanup() # Draw the text to the image p = QPainter(self.pixmap()) p.setRenderHints(QPainter.Antialiasing) font = build_font(self.config) p.setFont(font) pen = QPen(self.primary_color, 1, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin) p.setPen(pen) p.drawText(self.current_pos, self.current_text) self.update() self.reset_mode() elif e.button() == Qt.RightButton and self.current_pos: self.reset_mode()
Example #8
Source File: crawl.py From IDACyber with MIT License | 6 votes |
def on_mb_click(self, event, addr, size, mouse_offs): button = event.button() if button == Qt.MiddleButton: mouse = addr+mouse_offs c = get_byte(mouse) head, name, size = self._get_item_info(mouse) funcname = self._get_func_name(mouse) self.ann = [(mouse, qRgb(c, 0xFF, self.hl_color), "Address: %X" % (mouse), qRgb(c, 0xFF, self.hl_color)), (None, None, " Item: %s" % (name), qRgb(c, 0xFF, self.hl_color)), (None, None, " Head: %X" % (head), qRgb(c, 0xFF, self.hl_color)), (None, None, " Size: %d" % (size), qRgb(c, 0xFF, self.hl_color)) ] if funcname: self.ann.append((None, None, " Function: %s" % (funcname), qRgb(c, 0xFF, self.hl_color))) self.last_sel = (head, size) elif button == Qt.MiddleButton: pass elif button == Qt.RightButton: self.switch ^= 1 msg('Highlighting %s\n' % self.mode[self.switch])
Example #9
Source File: occt_widget.py From CQ-editor with Apache License 2.0 | 6 votes |
def mouseMoveEvent(self,event): pos = event.pos() x,y = pos.x(),pos.y() if event.buttons() == Qt.LeftButton: self.view.Rotation(x,y) elif event.buttons() == Qt.MiddleButton: self.view.Pan(x - self.old_pos.x(), self.old_pos.y() - y, theToStart=True) elif event.buttons() == Qt.RightButton: self.view.ZoomAtPoint(self.old_pos.x(), y, x, self.old_pos.y()) self.old_pos = pos
Example #10
Source File: sms.py From IDACyber with MIT License | 5 votes |
def on_mb_click(self, event, addr, size, mouse_offs): button = event.button() if button == Qt.MiddleButton: self.cur_palette = (self.cur_palette + 1) % len(self.palettes) self.palette = self.palettes[self.cur_palette] if button == Qt.RightButton: self.sp_arrow = not self.sp_arrow self.palette = self.palettes[self.cur_palette]
Example #11
Source File: Q7VTKRenderWindowInteractor.py From pyCGNS with GNU Lesser General Public License v2.1 | 5 votes |
def mousePressEvent(self, ev): ctrl, shift = self._GetCtrlShift(ev) repeat = 0 if ev.type() == QEvent.MouseButtonDblClick: repeat = 1 self._Iren.SetEventInformationFlipY(ev.x(), ev.y(), ctrl, shift, chr(0), repeat, None) self._ActiveButton = ev.button() if self._ActiveButton == Qt.LeftButton: self._Iren.LeftButtonPressEvent() elif self._ActiveButton == Qt.RightButton: self._Iren.RightButtonPressEvent() elif self._ActiveButton == Qt.MidButton: self._Iren.MiddleButtonPressEvent() #def mouseReleaseEvent(self, ev): # ctrl, shift = self._GetCtrlShift(ev) # self._Iren.SetEventInformationFlipY(ev.x(), ev.y(), # ctrl, shift, chr(0), 0, None) # if self._ActiveButton == Qt.LeftButton: # self._Iren.LeftButtonReleaseEvent() # elif self._ActiveButton == Qt.RightButton: # self._Iren.RightButtonReleaseEvent() # elif self._ActiveButton == Qt.MidButton: # self._Iren.MiddleButtonReleaseEvent()
Example #12
Source File: QVTKRenderWindowInteractor.py From pyCGNS with GNU Lesser General Public License v2.1 | 5 votes |
def mouseReleaseEvent(self, ev): ctrl, shift = self._GetCtrlShift(ev) self._Iren.SetEventInformationFlipY(ev.x(), ev.y(), ctrl, shift, chr(0), 0, None) if self._ActiveButton == Qt.LeftButton: self._Iren.LeftButtonReleaseEvent() elif self._ActiveButton == Qt.RightButton: self._Iren.RightButtonReleaseEvent() elif self._ActiveButton == Qt.MidButton: self._Iren.MiddleButtonReleaseEvent()
Example #13
Source File: node_display_panel.py From pyNMS with GNU General Public License v3.0 | 5 votes |
def mousePressEvent(self, event): if event.buttons() == Qt.RightButton: menu = QMenu(self) no_label = QAction('No label', self) no_label.triggered.connect(lambda _: self.change_label(None)) menu.addAction(no_label) for property in subtype_labels[self.subtype]: action = QAction(str(property), self) action.triggered.connect(lambda _, p=property: self.change_label(p)) menu.addAction(action) menu.exec_(QCursor.pos()) super().mousePressEvent(event)
Example #14
Source File: xor.py From IDACyber with MIT License | 5 votes |
def on_mb_click(self, event, addr, size, mouse_offs): button = event.button() if button == Qt.MiddleButton: self._set_xor_key() elif button == Qt.RightButton: key = get_byte(addr + mouse_offs) self._set_xor_key(key) return
Example #15
Source File: expr.py From IDACyber with MIT License | 5 votes |
def on_mb_click(self, event, addr, size, mouse_offs): if event.button() == Qt.RightButton: self._set_user_expr()
Example #16
Source File: autoxor.py From IDACyber with MIT License | 5 votes |
def on_mb_click(self, event, addr, size, mouse_offs): if event.button() == Qt.RightButton: if self.highlight_key and self.timer: unregister_timer(self.timer) else: self._enable_timer() self.highlight_key = not self.highlight_key self.pw.on_filter_request_update() return
Example #17
Source File: dbg.py From IDACyber with MIT License | 5 votes |
def on_mb_click(self, event, addr, size, mouse_offs): if event.button() == Qt.RightButton: if ask_yn(1, "Clear trace?") == 1: self.hook.hits = {} return
Example #18
Source File: dragbutton.py From python with Apache License 2.0 | 5 votes |
def mouseMoveEvent(self, e): if e.buttons() != Qt.RightButton: # 只操作右键事件 return mimeData = QMimeData() drag = QDrag(self) # 创建一个QDrag对象,用来传输MIME-based数据 drag.setMimeData(mimeData) drag.setHotSpot(e.pos() - self.rect().topLeft()) dropAction = drag.exec_(Qt.MoveAction)
Example #19
Source File: ascii.py From IDACyber with MIT License | 5 votes |
def on_mb_click(self, event, addr, size, mouse_offs): if event.button() == Qt.RightButton: self._set_threshold()
Example #20
Source File: hubert.py From IDACyber with MIT License | 5 votes |
def on_mb_click(self, event, addr, size, mouse_offs): global hubert button = event.button() # disabled fixme first if False and button == Qt.LeftButton: milli_sec = time.time() * 1000 if (milli_sec - self.prev_click) > 2000: self.num_clicks = 0 self.pause_frames = self.intial_pause_frames self.match = False if self.num_clicks == 0: self.ref_click = milli_sec self.idx_frame = self.onbeat_frame self.num_clicks = 1 self.timer_speed = self.initial_timer_speed else: """http://yours-truly.de/node/577 https://inferno988.deviantart.com/art/FPS-to-FPB-to-BPM-Calculator-424778748 Here are the spells: - BPM = FPS/FPB * 60 - FPB = FPS / (BPM / 60) - FPS = (FPB * BPM) / 60""" self.bpm = 60000 * self.num_clicks / (milli_sec - self.ref_click) fpb = (len(hubert)+self.pause_frames) self.timer_speed = int(round(float(60000)/float(fpb*round(self.bpm)))) self.idx_frame = self.onbeat_frame self.num_clicks += 1 self.prev_click = milli_sec elif button == Qt.RightButton: self.distance = (self.distance + 1) % (self.max_distance+1) elif button == Qt.MiddleButton: pass return
Example #21
Source File: QVTKRenderWindowInteractor.py From Det3D with Apache License 2.0 | 5 votes |
def mouseReleaseEvent(self, ev): ctrl, shift = self._GetCtrlShift(ev) self._Iren.SetEventInformationFlipY( ev.x(), ev.y(), ctrl, shift, chr(0), 0, None ) if self._ActiveButton == Qt.LeftButton: self._Iren.LeftButtonReleaseEvent() elif self._ActiveButton == Qt.RightButton: self._Iren.RightButtonReleaseEvent() elif self._ActiveButton == Qt.MidButton: self._Iren.MiddleButtonReleaseEvent()
Example #22
Source File: QtImageViewer.py From PyQtImageViewer with MIT License | 5 votes |
def mouseDoubleClickEvent(self, event): """ Show entire image. """ scenePos = self.mapToScene(event.pos()) if event.button() == Qt.LeftButton: self.leftMouseButtonDoubleClicked.emit(scenePos.x(), scenePos.y()) elif event.button() == Qt.RightButton: if self.canZoom: self.zoomStack = [] # Clear zoom stack. self.updateViewer() self.rightMouseButtonDoubleClicked.emit(scenePos.x(), scenePos.y()) QGraphicsView.mouseDoubleClickEvent(self, event)
Example #23
Source File: QtImageViewer.py From PyQtImageViewer with MIT License | 5 votes |
def mousePressEvent(self, event): """ Start mouse pan or zoom mode. """ scenePos = self.mapToScene(event.pos()) if event.button() == Qt.LeftButton: if self.canPan: self.setDragMode(QGraphicsView.ScrollHandDrag) self.leftMouseButtonPressed.emit(scenePos.x(), scenePos.y()) elif event.button() == Qt.RightButton: if self.canZoom: self.setDragMode(QGraphicsView.RubberBandDrag) self.rightMouseButtonPressed.emit(scenePos.x(), scenePos.y()) QGraphicsView.mousePressEvent(self, event)
Example #24
Source File: webelem.py From qutebrowser with GNU General Public License v3.0 | 5 votes |
def right_click(self) -> None: """Simulate a right-click on the element.""" self._click_fake_event(usertypes.ClickTarget.normal, button=Qt.RightButton)
Example #25
Source File: pyEarth.py From pyEarth with MIT License | 5 votes |
def mouseMoveEvent(self, event): dx, dy = event.x() - self.last_pos.x(), event.y() - self.last_pos.y() if event.buttons() == Qt.LeftButton: self.rx, self.ry = self.rx + 8*dy, self.ry + 8*dx elif event.buttons() == Qt.RightButton: self.cx, self.cy = self.cx - dx/50, self.cy + dy/50 self.last_pos = event.pos()
Example #26
Source File: extended_pyEarth.py From pyEarth with MIT License | 5 votes |
def mouseMoveEvent(self, event): dx, dy = event.x() - self.last_pos.x(), event.y() - self.last_pos.y() if event.buttons() == Qt.LeftButton: self.rx, self.ry = self.rx + 8*dy, self.ry + 8*dx elif event.buttons() == Qt.RightButton: self.cx, self.cy = self.cx - dx/50, self.cy + dy/50 self.last_pos = event.pos()
Example #27
Source File: QtMouseDevice.py From Uranium with GNU Lesser General Public License v3.0 | 5 votes |
def _qtButtonsToButtonList(self, qt_buttons): buttons = [] if qt_buttons & Qt.LeftButton: buttons.append(MouseEvent.LeftButton) if qt_buttons & Qt.RightButton: buttons.append(MouseEvent.RightButton) if qt_buttons & Qt.MiddleButton: buttons.append(MouseEvent.MiddleButton) return buttons
Example #28
Source File: qcolorbutton.py From linux-show-player with GNU General Public License v3.0 | 5 votes |
def mousePressEvent(self, e): if e.button() == Qt.RightButton: self.setColor(None) return super(QColorButton, self).mousePressEvent(e)
Example #29
Source File: cue_widget.py From linux-show-player with GNU General Public License v3.0 | 5 votes |
def _clicked(self, event): if not (self.seekSlider.geometry().contains(event.pos()) and self.seekSlider.isVisible()): if event.button() != Qt.RightButton: if event.modifiers() == Qt.ShiftModifier: self.edit_request.emit(self.cue) elif event.modifiers() == Qt.ControlModifier: self.selected = not self.selected else: self.cue_executed.emit(self.cue) self.cue.execute()
Example #30
Source File: occt_widget.py From CQ-editor with Apache License 2.0 | 5 votes |
def mousePressEvent(self,event): pos = event.pos() if event.button() == Qt.LeftButton: self.view.StartRotation(pos.x(), pos.y()) elif event.button() == Qt.RightButton: self.view.StartZoomAtPoint(pos.x(), pos.y()) self.old_pos = pos