我们从Python开源项目中,提取了以下23个代码示例,用于说明如何使用PyQt5.QtCore.Qt.PointingHandCursor()。
def __init__(self, parent=None): super(SearchLineEdit, self).__init__() self.setObjectName("SearchLine") self.parent = parent self.setMinimumSize(218, 20) with open('QSS/searchLine.qss', 'r') as f: self.setStyleSheet(f.read()) self.button = QPushButton(self) self.button.setMaximumSize(13, 13) self.button.setCursor(QCursor(Qt.PointingHandCursor)) self.setTextMargins(3, 0, 19, 0) self.spaceItem = QSpacerItem(150, 10, QSizePolicy.Expanding) self.mainLayout = QHBoxLayout() self.mainLayout.addSpacerItem(self.spaceItem) # self.mainLayout.addStretch(1) self.mainLayout.addWidget(self.button) self.mainLayout.addSpacing(10) self.mainLayout.setContentsMargins(0, 0, 0, 0) self.setLayout(self.mainLayout)
def __init__(self, settings: QSettings): super(FavoritesTab, self).__init__() self.settings = settings faves_formLayout = QFormLayout(labelAlignment=Qt.AlignRight) self.faves_lineEdit = QLineEdit(self) self.faves_lineEdit.returnPressed.connect(self.add_item) self.faves_lineEdit.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) faves_addItemButton = QPushButton(parent=self, flat=False, cursor=Qt.PointingHandCursor, text='Add', icon=QIcon(':assets/images/plus.png'), toolTip='Add item', clicked=self.add_item) faves_addItemButton.setIconSize(QSize(12, 12)) faves_deleteItemButton = QPushButton(parent=self, flat=False, cursor=Qt.PointingHandCursor, text='Delete', icon=QIcon(':assets/images/minus.png'), toolTip='Delete selected item', clicked=self.delete_items) faves_deleteItemButton.setIconSize(QSize(12, 12)) faves_buttonLayout = QHBoxLayout() faves_buttonLayout.addWidget(faves_addItemButton) faves_buttonLayout.addWidget(faves_deleteItemButton) faves_formLayout.addRow('Item Label:', self.faves_lineEdit) faves_formLayout.addRow(faves_buttonLayout) faves_formLayout.addRow(self.get_notes()) self.faves_listWidget = QListWidget(self) self.faves_listWidget.setSelectionMode(QAbstractItemView.ExtendedSelection) self.faves_listWidget.setSortingEnabled(True) self.add_items(self.settings.value('favorites', '')) tab_layout = QHBoxLayout() tab_layout.addLayout(faves_formLayout) tab_layout.addWidget(self.faves_listWidget) self.setLayout(tab_layout)
def eventFilter(self, obj: QObject, event: QEvent) -> bool: if event.type() == QEvent.ToolTip: return True elif event.type() == QEvent.Enter and obj.isEnabled(): qApp.setOverrideCursor(Qt.PointingHandCursor) elif event.type() == QEvent.Leave: qApp.restoreOverrideCursor() elif event.type() == QEvent.StatusTip and not obj.isEnabled(): return True return super(VideoToolBar, self).eventFilter(obj, event)
def __init__(self, parent=None): super(LogsPage, self).__init__(parent) self.parent = parent self.setObjectName('settingslogspage') verboseCheckbox = QCheckBox('Enable verbose logging', self) verboseCheckbox.setToolTip('Detailed log ouput to log file and console') verboseCheckbox.setCursor(Qt.PointingHandCursor) verboseCheckbox.setChecked(self.parent.parent.verboseLogs) verboseCheckbox.stateChanged.connect(self.setVerboseLogs) verboseLabel = QLabel(''' <b>ON:</b> includes detailed logs from video player (MPV) and backend services <br/> <b>OFF:</b> includes errors and important messages to log and console ''', self) verboseLabel.setObjectName('verboselogslabel') verboseLabel.setTextFormat(Qt.RichText) verboseLabel.setWordWrap(True) logsLayout = QVBoxLayout() logsLayout.addWidget(verboseCheckbox) logsLayout.addWidget(verboseLabel) logsGroup = QGroupBox('Logging') logsGroup.setLayout(logsLayout) mainLayout = QVBoxLayout() mainLayout.setSpacing(10) mainLayout.addWidget(logsGroup) mainLayout.addStretch(1) self.setLayout(mainLayout)
def eventFilter(self, obj: QObject, event: QEvent) -> bool: if event.type() == QEvent.Enter: qApp.setOverrideCursor(Qt.PointingHandCursor) elif event.type() == QEvent.Leave: qApp.restoreOverrideCursor() return super(ClipErrorsDialog.VCToolBox, self).eventFilter(obj, event)
def __init__(self, errors: list, parent=None, flags=Qt.WindowCloseButtonHint): super(ClipErrorsDialog, self).__init__(parent, flags) self.errors = errors self.parent = parent self.setWindowModality(Qt.ApplicationModal) self.setWindowTitle('Cannot add media file(s)') self.headingcolor = '#C681D5' if self.parent.theme == 'dark' else '#642C68' self.pencolor = '#FFF' if self.parent.theme == 'dark' else '#222' self.toolbox = ClipErrorsDialog.VCToolBox(self) self.toolbox.currentChanged.connect(self.selectItem) self.detailedLabel = QLabel(self) self.buttons = QDialogButtonBox(self) closebutton = self.buttons.addButton(QDialogButtonBox.Close) closebutton.clicked.connect(self.close) closebutton.setDefault(True) closebutton.setAutoDefault(True) closebutton.setCursor(Qt.PointingHandCursor) closebutton.setFocus() introLabel = self.intro() introLabel.setWordWrap(True) layout = QVBoxLayout() layout.addWidget(introLabel) layout.addSpacing(10) layout.addWidget(self.toolbox) layout.addSpacing(10) layout.addWidget(self.buttons) self.setLayout(layout) self.parseErrors()
def mouseMoveEvent(self, event: QMouseEvent) -> None: if self.count() > 0: modelindex = self.indexAt(event.pos()) if modelindex.isValid(): self.setCursor(Qt.PointingHandCursor) else: self.setCursor(Qt.ArrowCursor) super(VideoList, self).mouseMoveEvent(event)
def mouseReleaseEvent(self, event): if event.button() == Qt.LeftButton or event.button() == Qt.RightButton: if self.isPanning: self.setCursor(Qt.OpenHandCursor) elif self.isRotating: self.setCursor(Qt.PointingHandCursor)
def enterEvent(self, QEvent): self.setCursor(QCursor(Qt.PointingHandCursor))
def __init__(self, style, str_icon_on, str_icon_off, auto_repeat, size, receiver, key, str_key): super(KeyboardKey, self).__init__() self.__size = size self.__style = style self.__icon_on = str_icon_on self.__icon_off = str_icon_off self.__auto_repeat = auto_repeat self.__receiver = receiver self.__key = key self.__str_key = str_key self.set_up_button(style, str_icon_on, str_icon_off, auto_repeat, size, receiver, key, str_key) self.setCursor(QCursor(Qt.PointingHandCursor))
def __init__(self, *args): super().__init__(*args) self.setToolTip("search case") search_icon = QIcon() config = Config() search_icon.addPixmap(QPixmap(config.images + '/search.png'), QIcon.Normal, QIcon.Off) self.setIcon(search_icon) # self.setText("Search") self.setCursor(Qt.PointingHandCursor) self.setFixedSize(22, 22) self.setStyleSheet( # "QPushButton{border-width:0px; background:transparent;} " "border:none; " )
def __init__(self, text, align=LEFT, userCode=0, parent=None, type=SIDEBAR): super(TextButton, self).__init__(parent) # Prevent a circular import. from menumanager import MenuManager self._menu_manager = MenuManager.instance() self.menuString = text self.buttonLabel = text self.alignment = align self.buttonType = type self.userCode = userCode self.scanAnim = None self.bgOn = None self.bgOff = None self.bgHighlight = None self.bgDisabled = None self.state = TextButton.OFF self.setAcceptHoverEvents(True) self.setCursor(Qt.PointingHandCursor) # Calculate the button size. if type in (TextButton.SIDEBAR, TextButton.PANEL): self.logicalSize = QSize(TextButton.BUTTON_WIDTH, TextButton.BUTTON_HEIGHT) else: self.logicalSize = QSize(int((TextButton.BUTTON_WIDTH / 2.0) - 5), int(TextButton.BUTTON_HEIGHT * 1.5)) self._prepared = False
def setState(self, state): self.state = state self.bgOn.setRecursiveVisible(state == TextButton.ON) self.bgOff.setRecursiveVisible(state == TextButton.OFF) self.bgHighlight.setRecursiveVisible(state == TextButton.HIGHLIGHT) self.bgDisabled.setRecursiveVisible(state == TextButton.DISABLED) if state == TextButton.DISABLED: self.setCursor(Qt.ArrowCursor) else: self.setCursor(Qt.PointingHandCursor)
def enterEvent(self, _): """ Executed when the mouse enter the Button. """ B3App.Instance().setOverrideCursor(QCursor(Qt.PointingHandCursor))
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 __init__(self, parent=None): super(VideoSlider, self).__init__(parent) self.parent = parent self.logger = logging.getLogger(__name__) self.theme = self.parent.theme self._styles = ''' QSlider:horizontal {{ margin: 16px 8px 32px; height: {sliderHeight}px; }} QSlider::sub-page:horizontal {{ border: none; background: {subpageBgColor}; height: {subpageHeight}px; position: absolute; left: 0; right: 0; margin: 0; margin-left: {subpageLeftMargin}px; }} QSlider::add-page:horizontal {{ border: none; background: transparent; }} QSlider::handle:horizontal {{ border: none; border-radius: 0; background: transparent url(:images/{handleImage}) no-repeat top center; width: 15px; height: {handleHeight}px; margin: -12px -8px -20px; }} QSlider::handle:horizontal:hover {{ background: transparent url(:images/{handleImageSelected}) no-repeat top center; }}''' self._progressbars = [] self._regions = [] self._regionHeight = 32 self._regionSelected = -1 self._cutStarted = False self._showSeekToolTip = True self._mouseOver = False self.showThumbs = True self.thumbnailsOn = False self.offset = 8 self.setOrientation(Qt.Horizontal) self.setObjectName('videoslider') self.setCursor(Qt.PointingHandCursor) self.setStatusTip('Set clip start and end points') self.setFocusPolicy(Qt.StrongFocus) self.setRange(0, 0) self.setSingleStep(1) self.setTickInterval(100000) self.setTracking(True) self.setTickPosition(QSlider.TicksBelow) self.setFocus() self.restrictValue = 0 self.valueChanged.connect(self.on_valueChanged) self.rangeChanged.connect(self.on_rangeChanged) self.installEventFilter(self)
def __init__(self, filename: str, filesize: str, runtime: str, icon: str, parent=None): super(JobCompleteNotification, self).__init__(icon, parent) pencolor = '#C681D5' if self.theme == 'dark' else '#642C68' self.filename = filename self.filesize = filesize self.runtime = runtime self.parent = parent self.title = 'Your media file is ready!' self.message = ''' <style> h1 {{ color: {labelscolor}; font-family: "Futura-Light", sans-serif; font-weight: 400; text-align: center; }} table.info {{ margin: 6px; padding: 4px 2px; font-family: "Noto Sans UI", sans-serif; }} td.label {{ font-weight: bold; color: {labelscolor}; text-transform: lowercase; text-align: right; padding-right: 5px; font-size: 14px; }} td.value {{ color: {valuescolor}; font-size: 14px; }} </style> <h1>{heading}</h1> <table border="0" class="info" cellpadding="2" cellspacing="0" align="left"> <tr> <td width="20%%" class="label"><b>File:</b></td> <td width="80%%" class="value" nowrap>{filename}</td> </tr> <tr> <td width="20%%" class="label"><b>Size:</b></td> <td width="80%%" class="value">{filesize}</td> </tr> <tr> <td width="20%%" class="label"><b>Runtime:</b></td> <td width="80%%" class="value">{runtime}</td> </tr> </table>'''.format(labelscolor=pencolor, valuescolor=('#EFF0F1' if self.theme == 'dark' else '#222'), heading=self._title, filename=os.path.basename(self.filename), filesize=self.filesize, runtime=self.runtime) playButton = QPushButton(QIcon(':/images/complete-play.png'), 'Play', self) playButton.setFixedWidth(82) playButton.clicked.connect(self.playMedia) playButton.setCursor(Qt.PointingHandCursor) self.buttons.append(playButton)