本文整理汇总了Python中PySide.QtGui.QPainter.drawPoints方法的典型用法代码示例。如果您正苦于以下问题:Python QPainter.drawPoints方法的具体用法?Python QPainter.drawPoints怎么用?Python QPainter.drawPoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QPainter
的用法示例。
在下文中一共展示了QPainter.drawPoints方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _update_cursor
# 需要导入模块: from PySide.QtGui import QPainter [as 别名]
# 或者: from PySide.QtGui.QPainter import drawPoints [as 别名]
def _update_cursor(self):
x = self.diameter
w, h = x, x
pixmap = QPixmap(w, h)
pixmap.fill(Qt.transparent)
p = QPainter(pixmap)
p.drawPoints(self._points)
p.end()
self._cursor_pixmap = pixmap.createMaskFromColor(Qt.transparent)
示例2: QPainterDrawText
# 需要导入模块: from PySide.QtGui import QPainter [as 别名]
# 或者: from PySide.QtGui.QPainter import drawPoints [as 别名]
class QPainterDrawText(unittest.TestCase):
def setUp(self):
self.painter = QPainter()
self.text = 'teste!'
def tearDown(self):
del self.text
del self.painter
def testDrawText(self):
# bug #254
rect = self.painter.drawText(100, 100, 100, 100,
Qt.AlignCenter | Qt.TextWordWrap,
self.text)
self.assert_(isinstance(rect, QRect))
def testDrawTextWithRect(self):
# bug #225
rect = QRect(100, 100, 100, 100)
newRect = self.painter.drawText(rect, Qt.AlignCenter | Qt.TextWordWrap,
self.text)
self.assert_(isinstance(newRect, QRect))
def testDrawTextWithRectF(self):
'''QPainter.drawText(QRectF, ... ,QRectF*) inject code'''
rect = QRectF(100, 52.3, 100, 100)
newRect = self.painter.drawText(rect, Qt.AlignCenter | Qt.TextWordWrap,
self.text)
self.assert_(isinstance(newRect, QRectF))
def testDrawOverloads(self):
'''Calls QPainter.drawLines overloads, if something is
wrong Exception and chaos ensues. Bug #395'''
self.painter.drawLines([QLine(QPoint(0,0), QPoint(1,1))])
self.painter.drawLines([QPoint(0,0), QPoint(1,1)])
self.painter.drawLines([QPointF(0,0), QPointF(1,1)])
self.painter.drawLines([QLineF(QPointF(0,0), QPointF(1,1))])
self.painter.drawPoints([QPoint(0,0), QPoint(1,1)])
self.painter.drawPoints([QPointF(0,0), QPointF(1,1)])
self.painter.drawConvexPolygon([QPointF(10.0, 80.0),
QPointF(20.0, 10.0),
QPointF(80.0, 30.0),
QPointF(90.0, 70.0)])
self.painter.drawConvexPolygon([QPoint(10.0, 80.0),
QPoint(20.0, 10.0),
QPoint(80.0, 30.0),
QPoint(90.0, 70.0)])
self.painter.drawPolygon([QPointF(10.0, 80.0),
QPointF(20.0, 10.0),
QPointF(80.0, 30.0),
QPointF(90.0, 70.0)])
self.painter.drawPolygon([QPoint(10.0, 80.0),
QPoint(20.0, 10.0),
QPoint(80.0, 30.0),
QPoint(90.0, 70.0)])
self.painter.drawPolyline([QPointF(10.0, 80.0),
QPointF(20.0, 10.0),
QPointF(80.0, 30.0),
QPointF(90.0, 70.0)])
self.painter.drawPolyline([QPoint(10.0, 80.0),
QPoint(20.0, 10.0),
QPoint(80.0, 30.0),
QPoint(90.0, 70.0)])