當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。