本文整理汇总了Python中PyQt5.QtGui.QPolygonF.translate方法的典型用法代码示例。如果您正苦于以下问题:Python QPolygonF.translate方法的具体用法?Python QPolygonF.translate怎么用?Python QPolygonF.translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtGui.QPolygonF
的用法示例。
在下文中一共展示了QPolygonF.translate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: QRectF
# 需要导入模块: from PyQt5.QtGui import QPolygonF [as 别名]
# 或者: from PyQt5.QtGui.QPolygonF import translate [as 别名]
RectT,
Vec2T,
SegmentT
)
BASE_WIDTH = styles.PATH_BASE_WIDTH
BASE_RECT = QRectF(0, 0, BASE_WIDTH, BASE_WIDTH)
PHOS_ITEM_WIDTH = 0.25*BASE_WIDTH
TRIANGLE = QPolygonF()
TRIANGLE.append(QPointF(0, 0))
TRIANGLE.append(QPointF(0.75 * PHOS_ITEM_WIDTH, 0.5 * PHOS_ITEM_WIDTH))
TRIANGLE.append(QPointF(0, PHOS_ITEM_WIDTH))
TRIANGLE.append(QPointF(0, 0))
TRIANGLE.translate(0, -0.5*PHOS_ITEM_WIDTH)
T180 = QTransform()
T180.rotate(-180)
FWDPHOS_PP, REVPHOS_PP = QPainterPath(), QPainterPath()
FWDPHOS_PP.addPolygon(TRIANGLE)
REVPHOS_PP.addPolygon(T180.map(TRIANGLE))
KEYINPUT_ACTIVE_FLAG = QGraphicsItem.ItemIsFocusable
PROX_ALPHA = 64
class PropertyWrapperObject(QObject):
"""
Attributes:
animations (dict): Description
brush_alpha (TYPE): Description
示例2: QPolygonF
# 需要导入模块: from PyQt5.QtGui import QPolygonF [as 别名]
# 或者: from PyQt5.QtGui.QPolygonF import translate [as 别名]
getBrushObj,
getColorObj,
getNoPen,
getPenObj
)
from . import gridstyles as styles
PXI_PP_ITEM_WIDTH = IW = 2.0 # 1.5
TRIANGLE = QPolygonF()
TRIANGLE.append(QPointF(0, 0))
TRIANGLE.append(QPointF(0.75*IW, 0.5*IW))
TRIANGLE.append(QPointF(0, IW))
TRIANGLE.append(QPointF(0, 0))
# TRIANGLE.translate(-0.75*IW, -0.5*IW)
TRIANGLE.translate(-0.25*IW, -0.5*IW)
PXI_RECT = QRectF(0, 0, IW, IW)
T90, T270 = QTransform(), QTransform()
T90.rotate(90)
T270.rotate(270)
FWDPXI_PP, REVPXI_PP = QPainterPath(), QPainterPath()
FWDPXI_PP.addPolygon(T90.map(TRIANGLE))
REVPXI_PP.addPolygon(T270.map(TRIANGLE))
# FWDPXI_PP.moveTo(-0.5*IW, 0.7*IW)
# FWDPXI_PP.lineTo(0., -0.2*IW)
# FWDPXI_PP.lineTo(0.5*IW, 0.7*IW)
# extra1 = QPainterPath()
# extra1.addEllipse(-0.5*IW, 0.5*IW, IW, 0.4*IW)
# extra2 = QPainterPath()
示例3: drawToolButtonMenuIndicator
# 需要导入模块: from PyQt5.QtGui import QPolygonF [as 别名]
# 或者: from PyQt5.QtGui.QPolygonF import translate [as 别名]
def drawToolButtonMenuIndicator(self, option, painter, widget=None):
arrow_rect = self.proxy().subControlRect(QStyle.CC_ToolButton, option, QStyle.SC_ToolButtonMenu, widget)
text_color = option.palette.color(
QPalette.WindowText if option.state & QStyle.State_AutoRaise else QPalette.ButtonText
)
button_color = option.palette.color(QPalette.Button)
background_color = self.background_color(button_color, 0.5)
painter.save()
# draw separating vertical line
if option.state & (QStyle.State_On | QStyle.State_Sunken):
top_offset, bottom_offset = 4, 3
else:
top_offset, bottom_offset = 2, 2
if option.direction == Qt.LeftToRight:
separator_line = QLineF(
arrow_rect.x() - 3,
arrow_rect.top() + top_offset,
arrow_rect.x() - 3,
arrow_rect.bottom() - bottom_offset,
)
else:
separator_line = QLineF(
arrow_rect.right() + 3,
arrow_rect.top() + top_offset,
arrow_rect.right() + 3,
arrow_rect.bottom() - bottom_offset,
)
light_gradient = QLinearGradient(separator_line.p1(), separator_line.p2())
light_gradient.setColorAt(
0.0, ColorScheme.shade(self.background_top_color(button_color), ColorScheme.LightShade, 0.0)
)
light_gradient.setColorAt(
1.0, ColorScheme.shade(self.background_bottom_color(button_color), ColorScheme.MidlightShade, 0.5)
)
separator_color = ColorScheme.shade(self.background_bottom_color(button_color), ColorScheme.MidShade, 0.0)
painter.setRenderHint(QPainter.Antialiasing, False)
painter.setPen(QPen(light_gradient, 1))
painter.drawLine(separator_line.translated(-1, 0))
painter.drawLine(separator_line.translated(+1, 0))
painter.setPen(QPen(separator_color, 1))
painter.drawLine(separator_line)
# draw arrow
arrow = QPolygonF([QPointF(-3, -1.5), QPointF(0.5, 2.5), QPointF(4, -1.5)])
if option.direction == Qt.LeftToRight:
arrow.translate(-2, 1)
else:
arrow.translate(+2, 1)
pen_thickness = 1.6
painter.setRenderHint(QPainter.Antialiasing, True)
painter.translate(arrow_rect.center())
painter.translate(0, +1)
painter.setPen(
QPen(self.calc_light_color(background_color), pen_thickness, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin)
)
painter.drawPolyline(arrow)
painter.translate(0, -1)
painter.setPen(
QPen(self.deco_color(background_color, text_color), pen_thickness, Qt.SolidLine, Qt.RoundCap, Qt.RoundJoin)
)
painter.drawPolyline(arrow)
painter.restore()