本文整理汇总了Python中PyQt4.QtGui.QPolygonF方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QPolygonF方法的具体用法?Python QtGui.QPolygonF怎么用?Python QtGui.QPolygonF使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui
的用法示例。
在下文中一共展示了QtGui.QPolygonF方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getPolygon
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPolygonF [as 别名]
def getPolygon(self, obj):
poly = QtGui.QPolygonF()
for pt in obj.polygon:
point = QtCore.QPointF(pt.x,pt.y)
poly.append( point )
return poly
# Draw the labels in the given QPainter qp
# optionally provide a list of labels to ignore
示例2: clearPolygon
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPolygonF [as 别名]
def clearPolygon(self):
# We do not clear, since the drawPoly might be a reference on an object one
self.drawPoly = QtGui.QPolygonF()
self.drawPolyClosed = False
# Disable actions that need a polygon
for act in self.actPolyOrSelObj:
act.setEnabled(bool(self.selObjs))
for act in self.actClosedPoly:
act.setEnabled(False)
# We just closed the polygon and need to deal with this situation
示例3: drawZoom
# 需要导入模块: from PyQt4 import QtGui [as 别名]
# 或者: from PyQt4.QtGui import QPolygonF [as 别名]
def drawZoom(self,qp,overlay):
# Zoom disabled?
if not self.config.zoom:
return
# No image
if self.image.isNull() or not self.w or not self.h:
return
# No mouse
if not self.mousePos:
return
# Abbrevation for the zoom window size
zoomSize = self.config.zoomSize
# Abbrevation for the mouse position
mouse = self.mousePos
# The pixel that is the zoom center
pix = self.mousePosScaled
# The size of the part of the image that is drawn in the zoom window
selSize = zoomSize / ( self.config.zoomFactor * self.config.zoomFactor )
# The selection window for the image
sel = QtCore.QRectF(pix.x() -selSize/2 ,pix.y() -selSize/2 ,selSize,selSize )
# The selection window for the widget
view = QtCore.QRectF(mouse.x()-zoomSize/2,mouse.y()-zoomSize/2,zoomSize,zoomSize)
# Show the zoom image
qp.drawImage(view,self.image,sel)
# If we are currently drawing the polygon, we need to draw again in the zoom
if not self.drawPoly.isEmpty():
transform = QtGui.QTransform()
quadFrom = QtGui.QPolygonF()
quadFrom.append( sel.topLeft() )
quadFrom.append( sel.topRight() )
quadFrom.append( sel.bottomRight() )
quadFrom.append( sel.bottomLeft() )
quadTo = QtGui.QPolygonF()
quadTo.append( view.topLeft() )
quadTo.append( view.topRight() )
quadTo.append( view.bottomRight() )
quadTo.append( view.bottomLeft() )
if QtGui.QTransform.quadToQuad( quadFrom , quadTo , transform ):
qp.setClipRect(view)
#transform.translate(self.xoff,self.yoff)
self.drawDrawPoly(qp,transform)
else:
print( "not possible" )
#############################
## Mouse/keyboard events
#############################
# Mouse moved
# Need to save the mouse position
# Need to drag a polygon point
# Need to update the mouse selected object