本文整理汇总了Python中PySide.QtGui.QPen.setCosmetic方法的典型用法代码示例。如果您正苦于以下问题:Python QPen.setCosmetic方法的具体用法?Python QPen.setCosmetic怎么用?Python QPen.setCosmetic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QPen
的用法示例。
在下文中一共展示了QPen.setCosmetic方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: drawPolyline
# 需要导入模块: from PySide.QtGui import QPen [as 别名]
# 或者: from PySide.QtGui.QPen import setCosmetic [as 别名]
def drawPolyline(self):
path = [mark.coordinate() for mark in self.markerObjects]
pen = QPen(Qt.white)
pen.setWidth(2)
pen.setCosmetic(True)
polyline = QGeoMapPolylineObject()
polyline.setPen(pen)
polyline.setPath(path)
self.mapWidget.addMapObject(polyline)
示例2: routeFinished
# 需要导入模块: from PySide.QtGui import QPen [as 别名]
# 或者: from PySide.QtGui.QPen import setCosmetic [as 别名]
def routeFinished(self):
if not self.routeReply.routes():
return
route = QGeoMapRouteObject(self.routeReply.routes()[0])
routeColor = QColor(Qt.blue)
routeColor.setAlpha(127)
pen = QPen(routeColor)
pen.setWidth(7)
pen.setCosmetic(True)
pen.setCapStyle(Qt.RoundCap)
route.setPen(pen)
self.mapWidget.addMapObject(route)
示例3: drawPolygon
# 需要导入模块: from PySide.QtGui import QPen [as 别名]
# 或者: from PySide.QtGui.QPen import setCosmetic [as 别名]
def drawPolygon(self):
path = [mark.coordinate() for mark in self.markerObjects]
pen = QPen(Qt.white)
pen.setWidth(2)
pen.setCosmetic(True)
polygon = QGeoMapPolygonObject()
polygon.setPen(pen)
fill = QColor(Qt.black)
fill.setAlpha(65)
polygon.setBrush(QBrush(fill))
polygon.setPath(path)
self.mapWidget.addMapObject(polygon)
示例4: drawRect
# 需要导入模块: from PySide.QtGui import QPen [as 别名]
# 或者: from PySide.QtGui.QPen import setCosmetic [as 别名]
def drawRect(self):
if len(self.markerObjects) < 2:
return
p1, p2 = self.markerObjects[:2]
pen = QPen(Qt.white)
pen.setWidth(2)
pen.setCosmetic(True)
fill = QColor(Qt.black)
fill.setAlpha(65)
rectangle = QGeoMapRectangleObject(p1.coordinate(), p2.coordinate())
rectangle.setPen(pen)
rectangle.setBrush(QBrush(fill))
self.mapWidget.addMapObject(rectangle)
示例5: __init__
# 需要导入模块: from PySide.QtGui import QPen [as 别名]
# 或者: from PySide.QtGui.QPen import setCosmetic [as 别名]
def __init__(self, parent, child):
''' Create a new connection between a parent and a child item '''
super(Connection, self).__init__(parent)
self.parent = parent
self.child = child
self._start_point = None
self._end_point = None
self._middle_points = []
pen = QPen()
pen.setColor(Qt.blue)
pen.setCosmetic(False)
self.setPen(pen)
self.parent_rect = parent.sceneBoundingRect()
self.childRect = child.sceneBoundingRect()
# Activate cache mode to boost rendering by calling paint less often
self.setCacheMode(QGraphicsItem.DeviceCoordinateCache)
示例6: createPixmapIcon
# 需要导入模块: from PySide.QtGui import QPen [as 别名]
# 或者: from PySide.QtGui.QPen import setCosmetic [as 别名]
def createPixmapIcon(self):
self.markerIcon = QPixmap(MARKER_WIDTH, MARKER_HEIGHT)
self.markerIcon.fill(Qt.transparent)
painter = QPainter(self.markerIcon)
p1 = QPoint(MARKER_WIDTH / 2, MARKER_HEIGHT - 1)
p2 = QPoint(MARKER_WIDTH / 2, MARKER_HEIGHT - 1 - MARKER_PIN_LEN)
pen = QPen(Qt.black)
pen.setWidth(2)
pen.setCosmetic(True)
painter.setPen(pen)
painter.drawLine(p1, p2)
ellipse = QRect(0, 0, MARKER_WIDTH - 1, MARKER_HEIGHT - 1)
pen.setWidth(1)
painter.setPen(pen)
color = QColor(Qt.green)
color.setAlpha(127)
brush = QBrush(color)
painter.setBrush(brush)
painter.drawEllipse(ellipse)
示例7: drawCircle
# 需要导入模块: from PySide.QtGui import QPen [as 别名]
# 或者: from PySide.QtGui.QPen import setCosmetic [as 别名]
def drawCircle(self):
if not len(self.markerObjects):
return
p1 = self.markerObjects[0]
center = p1.coordinate()
radius = 3000 # Meters
if len(self.markerObjects) >= 2:
radius = center.distanceTo(self.markerObjects[1].coordinate())
pen = QPen(Qt.white)
pen.setWidth(2)
pen.setCosmetic(True)
circle = QGeoMapCircleObject(center, radius)
circle.setPen(pen)
fill = QColor(Qt.black)
fill.setAlpha(65)
circle.setBrush(QBrush(fill))
self.mapWidget.addMapObject(circle)