本文整理汇总了Python中PyQt5.QtCore.Qt.SizeBDiagCursor方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.SizeBDiagCursor方法的具体用法?Python Qt.SizeBDiagCursor怎么用?Python Qt.SizeBDiagCursor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.SizeBDiagCursor方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: updateMouseStyle
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import SizeBDiagCursor [as 别名]
def updateMouseStyle(self, stretchState):
"""
根据stretchState刷新鼠标的样式
:param stretchState:
:return:
"""
if stretchState == NO_SELECT:
self.setCursor(Qt.ArrowCursor)
elif stretchState == LEFT_TOP_RECT:
self.setCursor(Qt.SizeFDiagCursor)
elif stretchState == RIGHT_BOTTOM_RECT:
self.setCursor(Qt.SizeFDiagCursor)
elif stretchState == TOP_BORDER:
self.setCursor(Qt.SizeVerCursor)
elif stretchState == BOTTOM_BORDER:
self.setCursor(Qt.SizeVerCursor)
elif stretchState == RIGHT_TOP_RECT:
self.setCursor(Qt.SizeBDiagCursor)
elif stretchState == LEFT_BOTTOM_RECT:
self.setCursor(Qt.SizeBDiagCursor)
elif stretchState == LEFT_BORDER:
self.setCursor(Qt.SizeHorCursor)
elif stretchState == RIGHT_BORDER:
self.setCursor(Qt.SizeHorCursor)
else:
self.setCursor(Qt.ArrowCursor)
示例2: adjustCursor
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import SizeBDiagCursor [as 别名]
def adjustCursor(self, edge):
"""根据边方向调整光标样式
:param edge:
"""
cursor = None
if edge in (TOP, BOTTOM):
cursor = Qt.SizeVerCursor
elif edge in (LEFT, RIGHT):
cursor = Qt.SizeHorCursor
elif edge in (LEFT | TOP, RIGHT | BOTTOM):
cursor = Qt.SizeFDiagCursor
elif edge in (TOP | RIGHT, BOTTOM | LEFT):
cursor = Qt.SizeBDiagCursor
if cursor and cursor != self.cursor():
self.setCursor(cursor)
示例3: mouseMoveEvent
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import SizeBDiagCursor [as 别名]
def mouseMoveEvent(self, event):
"""鼠标移动事件"""
super(FramelessWindow, self).mouseMoveEvent(event)
pos = event.pos()
xPos, yPos = pos.x(), pos.y()
wm, hm = self.width() - self.Margins, self.height() - self.Margins
if self.isMaximized() or self.isFullScreen():
self.Direction = None
self.setCursor(Qt.ArrowCursor)
return
if event.buttons() == Qt.LeftButton and self._pressed:
self._resizeWidget(pos)
return
if xPos <= self.Margins and yPos <= self.Margins:
# 左上角
self.Direction = LeftTop
self.setCursor(Qt.SizeFDiagCursor)
elif wm <= xPos <= self.width() and hm <= yPos <= self.height():
# 右下角
self.Direction = RightBottom
self.setCursor(Qt.SizeFDiagCursor)
elif wm <= xPos and yPos <= self.Margins:
# 右上角
self.Direction = RightTop
self.setCursor(Qt.SizeBDiagCursor)
elif xPos <= self.Margins and hm <= yPos:
# 左下角
self.Direction = LeftBottom
self.setCursor(Qt.SizeBDiagCursor)
elif 0 <= xPos <= self.Margins and self.Margins <= yPos <= hm:
# 左边
self.Direction = Left
self.setCursor(Qt.SizeHorCursor)
elif wm <= xPos <= self.width() and self.Margins <= yPos <= hm:
# 右边
self.Direction = Right
self.setCursor(Qt.SizeHorCursor)
elif self.Margins <= xPos <= wm and 0 <= yPos <= self.Margins:
# 上面
self.Direction = Top
self.setCursor(Qt.SizeVerCursor)
elif self.Margins <= xPos <= wm and hm <= yPos <= self.height():
# 下面
self.Direction = Bottom
self.setCursor(Qt.SizeVerCursor)