当前位置: 首页>>代码示例>>Python>>正文


Python QPen.setCosmetic方法代码示例

本文整理汇总了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)
开发者ID:AmerGit,项目名称:Examples,代码行数:13,代码来源:mapviewer.py

示例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)
开发者ID:AmerGit,项目名称:Examples,代码行数:16,代码来源:mapviewer.py

示例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)
开发者ID:AmerGit,项目名称:Examples,代码行数:16,代码来源:mapviewer.py

示例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)
开发者ID:AmerGit,项目名称:Examples,代码行数:17,代码来源:mapviewer.py

示例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)
开发者ID:dbrabera,项目名称:opengeode,代码行数:18,代码来源:Connectors.py

示例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)
开发者ID:AmerGit,项目名称:Examples,代码行数:23,代码来源:mapviewer.py

示例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)
开发者ID:AmerGit,项目名称:Examples,代码行数:25,代码来源:mapviewer.py


注:本文中的PySide.QtGui.QPen.setCosmetic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。