我们从Python开源项目中,提取了以下8个代码示例,用于说明如何使用PyQt5.QtCore.Qt.ClosedHandCursor()。
def mousePressEvent(self, event): if self.isPanning or self.isRotating: self.setCursor(Qt.ClosedHandCursor) elif event.button() == Qt.LeftButton: clicked, offset, tol = self.getClickedDetails(event) xyForZ = {} for shape in self.shapes: hit = False z = shape.axis3_start_mill_depth if z not in xyForZ: xyForZ[z] = self.determineSelectedPosition(clicked, z, offset) hit |= shape.isHit(xyForZ[z], tol) if not hit: z = shape.axis3_mill_depth if z not in xyForZ: xyForZ[z] = self.determineSelectedPosition(clicked, z, offset) hit |= shape.isHit(xyForZ[z], tol) if self.isMultiSelect and shape.selected: hit = not hit if hit != shape.selected: g.window.TreeHandler.updateShapeSelection(shape, hit) shape.selected = hit self.update() self._lastPos = event.pos()
def mousePressEvent(self, event): self.mouseMoveLastPosition = event.scenePos(); if event.button() == Qt.LeftButton: self.setCursor(Qt.ClosedHandCursor) else: self.switchToNextEffect()
def mouseReleaseEvent(self, event: QMouseEvent): if self.scene() is None: return cursor = self.cursor().shape() if cursor == Qt.ClosedHandCursor: self.grab_start = None self.setCursor(Qt.OpenHandCursor) elif self.separation_area_moving: y_sep = self.mapToScene(event.pos()).y() y = self.sceneRect().y() h = self.sceneRect().height() if y_sep < y: y_sep = y elif y_sep > y + h: y_sep = y + h self.scene().draw_sep_area(y_sep) self.sep_area_moving.emit(y_sep) self.separation_area_moving = False self.y_sep = y_sep self.sep_area_changed.emit(-y_sep) self.unsetCursor() self.selection_area.finished = True self.selection_area.resizing = False self.emit_selection_size_changed() self.emit_selection_start_end_changed()
def __init__(self, parent): super(HomographyView, self).__init__(parent) self.cursor_default = QtGui.QCursor(Qt.CrossCursor) self.cursor_hover = QtGui.QCursor(Qt.OpenHandCursor) self.cursor_drag = QtGui.QCursor(Qt.ClosedHandCursor) self.image_loaded = False self.status_label = None
def __init__(self): self.m_cursorNames = QList() self.m_cursorIcons = QMap() self.m_valueToCursorShape = QMap() self.m_cursorShapeToValue = QMap() self.appendCursor(Qt.ArrowCursor, QCoreApplication.translate("QtCursorDatabase", "Arrow"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-arrow.png")) self.appendCursor(Qt.UpArrowCursor, QCoreApplication.translate("QtCursorDatabase", "Up Arrow"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-uparrow.png")) self.appendCursor(Qt.CrossCursor, QCoreApplication.translate("QtCursorDatabase", "Cross"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-cross.png")) self.appendCursor(Qt.WaitCursor, QCoreApplication.translate("QtCursorDatabase", "Wait"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-wait.png")) self.appendCursor(Qt.IBeamCursor, QCoreApplication.translate("QtCursorDatabase", "IBeam"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-ibeam.png")) self.appendCursor(Qt.SizeVerCursor, QCoreApplication.translate("QtCursorDatabase", "Size Vertical"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-sizev.png")) self.appendCursor(Qt.SizeHorCursor, QCoreApplication.translate("QtCursorDatabase", "Size Horizontal"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-sizeh.png")) self.appendCursor(Qt.SizeFDiagCursor, QCoreApplication.translate("QtCursorDatabase", "Size Backslash"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-sizef.png")) self.appendCursor(Qt.SizeBDiagCursor, QCoreApplication.translate("QtCursorDatabase", "Size Slash"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-sizeb.png")) self.appendCursor(Qt.SizeAllCursor, QCoreApplication.translate("QtCursorDatabase", "Size All"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-sizeall.png")) self.appendCursor(Qt.BlankCursor, QCoreApplication.translate("QtCursorDatabase", "Blank"), QIcon()) self.appendCursor(Qt.SplitVCursor, QCoreApplication.translate("QtCursorDatabase", "Split Vertical"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-vsplit.png")) self.appendCursor(Qt.SplitHCursor, QCoreApplication.translate("QtCursorDatabase", "Split Horizontal"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-hsplit.png")) self.appendCursor(Qt.PointingHandCursor, QCoreApplication.translate("QtCursorDatabase", "Pointing Hand"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-hand.png")) self.appendCursor(Qt.ForbiddenCursor, QCoreApplication.translate("QtCursorDatabase", "Forbidden"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-forbidden.png")) self.appendCursor(Qt.OpenHandCursor, QCoreApplication.translate("QtCursorDatabase", "Open Hand"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-openhand.png")) self.appendCursor(Qt.ClosedHandCursor, QCoreApplication.translate("QtCursorDatabase", "Closed Hand"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-closedhand.png")) self.appendCursor(Qt.WhatsThisCursor, QCoreApplication.translate("QtCursorDatabase", "What's This"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-whatsthis.png")) self.appendCursor(Qt.BusyCursor, QCoreApplication.translate("QtCursorDatabase", "Busy"), QIcon(":/qt-project.org/qtpropertybrowser/images/cursor-busy.png"))
def mousePressEvent(self, event: QMouseEvent): if self.scene() is None: return cursor = self.cursor().shape() has_shift_modifier = event.modifiers() == Qt.ShiftModifier is_in_shift_mode = (has_shift_modifier and self.hold_shift_to_drag) \ or (not has_shift_modifier and not self.hold_shift_to_drag) \ and cursor != Qt.SplitHCursor and cursor != Qt.SplitVCursor if event.buttons() == Qt.LeftButton and is_in_shift_mode: self.setCursor(Qt.ClosedHandCursor) self.grab_start = event.pos() elif event.buttons() == Qt.LeftButton: if self.is_pos_in_separea(self.mapToScene(event.pos())): self.separation_area_moving = True self.setCursor(Qt.SplitVCursor) elif self.selection_area.is_empty or self.selection_area.selected_edge is None: # Create new selection self.mouse_press_pos = event.pos() self.mouse_pos = event.pos() scene_pos = self.mapToScene(self.mouse_press_pos) self.__set_selection_area(x=scene_pos.x(), y=scene_pos.y(), w=0, h=0) self.selection_area.finished = False elif self.selection_area.selected_edge is not None: self.selection_area.resizing = True