def dropEvent(self, event):
"""
Handle 'Drop' event.
"""
if event.mimeData().hasUrls():
B3App.Instance().setOverrideCursor(QCursor(Qt.ArrowCursor))
event.setDropAction(Qt.CopyAction)
# multi-drag support
for url in event.mimeData().urls():
path = url.path()
if b3.getPlatform() == 'nt':
# on win32 the absolute path returned for each url has a leading slash: this obviously
# is not correct on win32 platform when absolute url have the form C:\\Programs\\... (Qt bug?)
path = path.lstrip('/').lstrip('\\')
if os.path.isfile(path):
self.parent().parent().make_new_process(path)
event.accept()
else:
event.ignore()
############################################ TOOLBAR HANDLERS ######################################################
python类ArrowCursor()的实例源码
def ShowCursor(self):
"""Shows the cursor."""
vtk_cursor = self._Iren.GetRenderWindow().GetCurrentCursor()
qt_cursor = self._CURSOR_MAP.get(vtk_cursor, Qt.ArrowCursor)
self.setCursor(qt_cursor)
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 mouseMoveEvent(self, event):
if event.pos():
self.bar.show()
self.setCursor(Qt.ArrowCursor)
self.cursorTimer.start(3000)
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 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 dragLeaveEvent(self, event):
"""
Handle 'Drag Leave' event.
"""
B3App.Instance().setOverrideCursor(QCursor(Qt.ArrowCursor))
def leaveEvent(self, _):
"""
Executed when the mouse leave the Button.
"""
B3App.Instance().setOverrideCursor(QCursor(Qt.ArrowCursor))
def leaveEvent(self, _):
"""
Executed when the mouse leave the Button.
"""
B3App.Instance().setOverrideCursor(QCursor(Qt.ArrowCursor))
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)
qtpropertybrowserutils.py 文件源码
项目:QtPropertyBrowserV2.6-for-pyqt5
作者: theall
项目源码
文件源码
阅读 25
收藏 0
点赞 0
评论 0
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"))