本文整理汇总了Python中PyQt5.QtGui.QCursor方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QCursor方法的具体用法?Python QtGui.QCursor怎么用?Python QtGui.QCursor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui
的用法示例。
在下文中一共展示了QtGui.QCursor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCursor [as 别名]
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)
示例2: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCursor [as 别名]
def __init__(self, parent, uiwidget=None, home_var=None, tmp=None, logr=None):
super(PlaylistWidget, self).__init__(parent)
global MainWindow, home, TMPDIR, logger, ui
self.setDefaultDropAction(QtCore.Qt.MoveAction)
self.setAcceptDrops(True)
self.setDragEnabled(True)
self.setDragDropMode(QtWidgets.QAbstractItemView.InternalMove)
self.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
self.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
self.downloadWget = []
self.downloadWget_cnt = 0
MainWindow = parent
ui = uiwidget
self.ui = uiwidget
TMPDIR = tmp
home = home_var
logger = logr
self.upcount = 0
self.downcount = 0
self.count_limit = 1
self.pc_to_pc_dict = {}
self.verify_slave_ssl = True
self.discover_slave_thread = None
示例3: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCursor [as 别名]
def __init__(self, parent, uiwidget, name):
super(GSBCSlider, self).__init__(parent)
global ui
self.parent = parent
ui = uiwidget
self.setObjectName(name)
self.setOrientation(QtCore.Qt.Horizontal)
if name == 'zoom':
self.setRange(-2000, 2000)
self.setSingleStep(10)
self.setPageStep(10)
elif name == 'speed':
self.setRange(-100, 900)
self.setSingleStep(10)
self.setPageStep(10)
else:
self.setRange(-100, 100)
self.setSingleStep(1)
self.setPageStep(1)
#self.setTickInterval(5)
self.setValue(0)
self.setMouseTracking(True)
self.valueChanged.connect(self.adjust_gsbc_values)
self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
#self.setTickPosition(QtWidgets.QSlider.TicksAbove)
示例4: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCursor [as 别名]
def __init__(self, inMsg=' Loading...', inMaxStep=1):
"""
"""
# Save reference to the QGIS interface
# initialize progressBar
# QApplication.processEvents() # Help to keep UI alive
self.iface = iface
widget = iface.messageBar().createMessage('Please wait ', inMsg)
prgBar = QProgressBar()
self.prgBar = prgBar
widget.layout().addWidget(self.prgBar)
iface.messageBar().pushWidget(widget)
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
# if Max 0 and value 0, no progressBar, only cursor loading
# default is set to 0
prgBar.setValue(1)
# set Maximum for progressBar
prgBar.setMaximum(inMaxStep)
示例5: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCursor [as 别名]
def __init__(self, *args, **kwargs):
super(EditableItem, self).__init__(*args, **kwargs)
self.setZValue(10)
self.setAcceptHoverEvents(True)
self.setFlag(QtWidgets.QGraphicsItem.ItemIsSelectable, True)
self.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable, True)
self.setFlag(QtWidgets.QGraphicsItem.ItemSendsGeometryChanges, True)
self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.setOpacity(0.5)
self.signals = EditableItemSignals()
self._labels_dao = LabelDao()
self._label = LabelVO()
self._tag = None
self._shape_type = None
app = QApplication.instance()
color = app.palette().color(QPalette.Highlight)
self._pen_color = color
self._pen_width = 2
self._brush_color = color
self.setPen(QtGui.QPen(self._pen_color, self._pen_width))
示例6: on_right_click
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCursor [as 别名]
def on_right_click(self, position):
if not position:
position = self.viewport().mapFromGlobal(QCursor().pos())
item = self.itemAt(position)
if not item:
return
widget = self.itemWidget(item)
menu = QMenu(self)
open_file_action = QAction("Open file")
open_file_action.triggered.connect(lambda: open_path(widget.path))
menu.addAction(open_file_action)
open_folder_action = QAction("Open enclosing folder")
open_folder_action.triggered.connect(
lambda: self.on_double_click(item)
)
menu.addAction(open_folder_action)
menu.exec_(self.viewport().mapToGlobal(position))
示例7: _breathing_gi_hover
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCursor [as 别名]
def _breathing_gi_hover(self):
if mc.mc_global.breathing_state == mc.mc_global.BreathingState.breathing_in:
return
hover_rectangle_qsize = QtCore.QSizeF(BR_WIDTH_FT, BR_HEIGHT_FT)
# noinspection PyCallByClass
pos_pointf = QtWidgets.QGraphicsItem.mapFromItem(
self._breathing_gi,
self._breathing_gi,
self._breathing_gi.x() + (self._breathing_gi.boundingRect().width() - hover_rectangle_qsize.width()) / 2,
self._breathing_gi.y() + (self._breathing_gi.boundingRect().height() - hover_rectangle_qsize.height()) / 2
)
# -widget coords
hover_rectangle_coords_qrect = QtCore.QRectF(pos_pointf, hover_rectangle_qsize)
cursor = QtGui.QCursor() # -screen coords
cursor_pos_widget_coords_qp = self.mapFromGlobal(cursor.pos()) # -widget coords
logging.debug("cursor.pos() = " + str(cursor.pos()))
logging.debug("cursor_pos_widget_coords_qp = " + str(cursor_pos_widget_coords_qp))
logging.debug("hover_rectangle_coords_qrect = " + str(hover_rectangle_coords_qrect))
if hover_rectangle_coords_qrect.contains(cursor_pos_widget_coords_qp):
mc.mc_global.breathing_state = mc.mc_global.BreathingState.breathing_in
self.ib_signal.emit()
self.text_gi.update_pos_and_origin_point(VIEW_WIDTH_INT, VIEW_HEIGHT_INT)
self._breathing_gi.update_pos_and_origin_point(VIEW_WIDTH_INT, VIEW_HEIGHT_INT)
示例8: _set_size_attributes
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCursor [as 别名]
def _set_size_attributes(self):
"""Sets the size policies of frame"""
size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
size_policy.setHorizontalStretch(0)
size_policy.setVerticalStretch(0)
size_policy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
self.setSizePolicy(size_policy)
self.setCursor(QCursor(Qt.ArrowCursor))
self.setFrameShape(QFrame.StyledPanel)
self.setFrameShadow(QFrame.Raised)
self.setLineWidth(1)
示例9: __init__
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCursor [as 别名]
def __init__(self, *args, **kwargs):
"""Same constructor as QLineEdit + config validator
"""
self.url = "https://eomys.com/"
# Call the QLabel constructor
super(HelpButton, self).__init__(*args, **kwargs)
self.setCursor(QCursor(Qt.PointingHandCursor))
self.setPixmap(QPixmap(":/images/images/icon/help_16.png"))
示例10: cursor_function
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCursor [as 别名]
def cursor_function(self, val):
widget, opt = val
if opt == "show":
widget.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
else:
if platform.system().lower() == "darwin" and widget == ui.tab_5:
widget.arrow_timer.start(1000)
else:
widget.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
示例11: arrow_hide
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCursor [as 别名]
def arrow_hide(self):
if self.player_val in ["mplayer", "mpv", "libmpv"]:
if self.ui.frame_extra_toolbar.isHidden() and self.ui.list2.isHidden():
self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
self.setFocus()
logger.debug("arrow hide")
elif self.hasFocus():
self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
logger.debug('player has focus')
else:
logger.debug('player not focussed')
示例12: thumbnail_fs_focus
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCursor [as 别名]
def thumbnail_fs_focus(self):
#for i in range(0, 4):
#p = "ui.label_epn_"+str(ui.thumbnail_label_number[0])+".setFocus()"
#exec(p)
self.setFocus()
self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
ui.frame1.hide()
示例13: arrow_hide
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCursor [as 别名]
def arrow_hide(self):
if gui.player_val in ['mpv', 'mplayer', 'libmpv']:
if self.hasFocus():
self.setCursor(QtGui.QCursor(QtCore.Qt.BlankCursor))
logger.debug('player has focus')
#QtWidgets.QApplication.setOverrideCursor(QtCore.Qt.BlankCursor);
else:
logger.debug('player not focussed')
if (self.ui.fullscreen_video and self.hasFocus() and self.ui.tab_6.isHidden()
and self.ui.list2.isHidden() and self.ui.tab_2.isHidden()):
self.ui.frame1.hide()
示例14: add_uri_audio_media_cue
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCursor [as 别名]
def add_uri_audio_media_cue():
"""Add audio MediaCue(s) form user-selected files"""
if get_backend() is None:
QMessageBox.critical(MainWindow(), 'Error', 'Backend not loaded')
return
# Default path to system "music" folder
path = QStandardPaths.writableLocation(QStandardPaths.MusicLocation)
# Get the backend extensions and create a filter for the Qt file-dialog
extensions = get_backend().supported_extensions()
filters = qfile_filters(extensions, anyfile=False)
# Display a file-dialog for the user to choose the media-files
files, _ = QFileDialog.getOpenFileNames(MainWindow(),
translate('MediaCueMenus',
'Select media files'),
path, filters)
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
# Create media cues, and add them to the Application cue_model
for file in files:
cue = CueFactory.create_cue('URIAudioCue', uri='file://' + file)
# Use the filename without extension as cue name
cue.name = os.path.splitext(os.path.basename(file))[0]
Application().cue_model.add(cue)
QApplication.restoreOverrideCursor()
示例15: waitClick
# 需要导入模块: from PyQt5 import QtGui [as 别名]
# 或者: from PyQt5.QtGui import QCursor [as 别名]
def waitClick(self, numClick, type, object):
self.object = object
self.addType = type
self.addObj = True
self.views()[0].viewport().setCursor(QtGui.QCursor(QtCore.Qt.CrossCursor))
self.parent().statusbar.showMessage(QtWidgets.QApplication.translate("pychemqt",
"Click in desire text position in screen"))
self.Pos = []
self.clickCollector = WaitforClick(numClick, self)
self.clickCollector.finished.connect(self.click)
self.clickCollector.start()