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


Python QtCore.QPointF类代码示例

本文整理汇总了Python中PyQt4.QtCore.QPointF的典型用法代码示例。如果您正苦于以下问题:Python QPointF类的具体用法?Python QPointF怎么用?Python QPointF使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QPointF类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: showMoveHelper

 def showMoveHelper(self, visible=True):
     """show help text In empty HandBoards"""
     if visible:
         if not self.__moveHelper:
             splitter = QGraphicsRectItem(self)
             hbCenter = self.rect().center()
             splitter.setRect(hbCenter.x() * 0.5, hbCenter.y(), hbCenter.x() * 1, 1)
             helpItems = [splitter]
             for name, yFactor in [(m18n('Move Exposed Tiles Here'), 0.5),
                                     (m18n('Move Concealed Tiles Here'), 1.5)]:
                 helper = QGraphicsSimpleTextItem(name, self)
                 helper.setScale(3)
                 nameRect = QRectF()
                 nameRect.setSize(helper.mapToParent(helper.boundingRect()).boundingRect().size())
                 center = QPointF(hbCenter)
                 center.setY(center.y() * yFactor)
                 helper.setPos(center - nameRect.center())
                 if self.sceneRotation() == 180:
                     rotateCenter(helper, 180)
                 helpItems.append(helper)
             self.__moveHelper = self.scene().createItemGroup(helpItems)
         self.__moveHelper.setVisible(True)
     else:
         if self.__moveHelper:
             self.__moveHelper.setVisible(False)
开发者ID:ospalh,项目名称:kajongg-fork,代码行数:25,代码来源:handboard.py

示例2: pointAt

 def pointAt(self, axes, axis_values):
     """
     Returns the point that best represents this graph information.
     
     :param      axes        | [<XChartAxis>, ..]
                 axis_values | {<str> axisName, <variant> value
     
     :return     <QPointF>
     """
     point = QPointF()
     
     rect = self._buildData.get('axis_rect')
     if not rect:
         return point
     
     x_range = rect.right() - rect.left()
     y_range = rect.bottom() - rect.top()
     
     for axis in axes:
         if not axis.name() in axis_values:
             continue
         
         perc = axis.percentAt(axis_values[axis.name()])
         if axis.orientation() == Qt.Vertical:
             point.setY(rect.bottom() - perc * y_range)
         else:
             point.setX(rect.left() + perc * x_range)
     
     return point
开发者ID:satishgoda,项目名称:DPS_PIPELINE,代码行数:29,代码来源:xchartrenderer.py

示例3: __init__

    def __init__(self, head, tail, uuid):
        QGraphicsObject.__init__(self)

        if not issubclass(head.__class__, dict) and not isinstance(tail.__class__, dict):
            raise AttributeError

        self.setZValue(0.0)

        self.__kId = uuid
        self.__head = head
        self.__tail = tail

        if  head[ENode.kGuiAttributeType].match(EAttribute.kTypeInput):
            self.__head = tail
            self.__tail = head

        self.__head[ENode.kGuiAttributeParent].onMove.connect(self.update)
        self.__tail[ENode.kGuiAttributeParent].onMove.connect(self.update)

        self.__headPoint = QPointF(0.0, 0.0)
        self.__tailPoint = QPointF(0.0, 0.0)

        self.__pen = QPen(QColor(43, 43, 43), 2, Qt.SolidLine)

        self.update()
开发者ID:raiscui,项目名称:edd,代码行数:25,代码来源:eedge.py

示例4: __init__

    def __init__(self, rect=None):
        super(TaskGraphicsItem, self).__init__()

        if rect is not None:
            self.setRect(rect)

        self.setPen(QPen(Qt.NoPen))

        # Setup the text item
        self.textItem = QGraphicsTextItem()
        self.textItem.setParentItem(self)
        self.textItem.rotate(-90)
        self.textItem.setDefaultTextColor(QColor(255, 255, 255))

        # The dimensions to reach via a LERP.
        self.startPos = QPointF(0, 0)
        self.endPos = QPointF(0, 0)
        self.startDiameter = 1
        self.endDiameter = 1

        self.centerMark = QGraphicsEllipseItem()
        self.centerMark.setBrush(QBrush(Qt.white))
        self.centerMark.setPen(QPen(Qt.NoPen))
        self.centerMark.setParentItem(self)

        self.pid = -1

        # To determine if it is associated with an active process.
        self.used = False
开发者ID:Unit978,项目名称:TaskVisualizer,代码行数:29,代码来源:TaskGraphicsItem.py

示例5: draw

 def draw(self, qpainter, zoom=1):
     """Draw this figure
     Parameters
     ----------
     qpainter: PySide.QtGui.QPainter
     """
     size_x = self.size_x * zoom
     size_y = self.size_y * zoom
     pensize = 3
     qpainter.setPen(
         QtGui.QPen(PipelineDrawer.blue_cta, pensize, QtCore.Qt.SolidLine))
     text_pos = QPointF(self.center)
     text_pos.setX(text_pos.x() - size_x / 2 + 2)
     text_pos.setY(text_pos.y() + pensize)
     qpainter.drawText(text_pos, str(self.nb_job_done))
     pt = QPointF(self.center)
     pt.setX(5)
     pos = self.name.find("$$thread_number$$")
     if pos != -1:
         name = self.name[0:pos]
     else:
         name = self.name
     qpainter.drawText(pt, name)
     if self.running == True:
         qpainter.setPen(
             QtGui.QPen(PipelineDrawer.mygreen, 3, QtCore.Qt.SolidLine))
     else:
         qpainter.setPen(
             QtGui.QPen(PipelineDrawer.blue_cta, 3, QtCore.Qt.SolidLine))
     x1 = self.center.x() - (size_x / 2)
     y1 = self.center.y() - (size_y / 2)
     qpainter.drawRoundedRect(x1, y1, size_x, size_y, 12.0, 12.0)
开发者ID:rdelosreyes,项目名称:ctapipe,代码行数:32,代码来源:pipelinedrawer.py

示例6: foldInput

 def foldInput(self, folded):
     self.element.paramsFolded = folded
     self.prepareGeometryChange()
     if self.element.algorithm.outputs:
         pt = self.getLinkPointForOutput(-1)
         pt = QPointF(0, pt.y())
         self.outButton.position = pt
     self.update()
开发者ID:RachitKansal,项目名称:QGIS,代码行数:8,代码来源:ModelerGraphicItem.py

示例7: paint

 def paint(self, painter, option, widget=None):
     pt = QPointF(-self.WIDTH / 2, -self.HEIGHT / 2) + self.position
     rect = QRectF(pt.x(), pt.y(), self.WIDTH, self.HEIGHT)
     if self.isIn:
         painter.setPen(QPen(Qt.transparent, 1))
         painter.setBrush(QBrush(Qt.lightGray, Qt.SolidPattern))
     else:
         painter.setPen(QPen(Qt.transparent, 1))
         painter.setBrush(QBrush(Qt.transparent, Qt.SolidPattern))
     painter.drawRect(rect)
     painter.drawPixmap(pt.x(), pt.y(), self.pixmap)
开发者ID:olivierdalang,项目名称:QGIS,代码行数:11,代码来源:ModelerGraphicItem.py

示例8: __getAttributePosition

    def __getAttributePosition(self, attrType):

        attr_x_pos = 0

        if attrType.match(EAttribute.kTypeOutput):

            attr_x_pos = self.__titleRect.width() - self.__attrRect.width()
            rect = self.__attrRect.translated(
                QPointF(attr_x_pos, self.__out_attr_step))

            point = QPointF((rect.topRight() + rect.bottomRight()) / 2)
            point.setX(point.x() + self.pen().width() * 2)

            self.__out_attr_step += self.__attrRect.width() + self.pen().width(
            )

            return [rect, point]

        rect = self.__attrRect.translated(
            QPointF(attr_x_pos, self.__in_attr_step))
        point = QPointF((rect.topLeft() + rect.bottomLeft()) / 2)
        point.setX(point.x() - self.pen().width() * 2)

        self.__in_attr_step += self.__attrRect.width() + self.pen().width()

        return [rect, point]
开发者ID:shrimo,项目名称:node_image_tools,代码行数:26,代码来源:enode.py

示例9: movePoints

 def movePoints(self, image_name, pt_ids):
     if image_name == self.image_name:
         data = self.current_data
         dm = self.data_manager
         points = self.points
         cells = self.cells
         for pt_id in pt_ids:
             pos = data[pt_id]
             pos = QPointF(pos.x() / self.min_scale, pos.y() / self.min_scale)
             points[pt_id].setPos(pos)
             for cid in dm.cell_points[pt_id]:
                 cell = cells.get(cid, None)
                 if cell is not None and cell.isVisible():
                     cell.setGeometry()
开发者ID:PierreBdR,项目名称:point_tracker,代码行数:14,代码来源:tracking_scene.py

示例10: beginDrawing

 def beginDrawing(self, pos, sliceRect):
     self.sliceRect = sliceRect
     self.scene.clear()
     self.bb = QRect()
     self.pos = QPointF(pos.x()+0.0001, pos.y()+0.0001)
     line = self.moveTo(pos)
     return line
开发者ID:LimpingTwerp,项目名称:volumina,代码行数:7,代码来源:brushingmodel.py

示例11: __init__

    def __init__(self, parent):
        QDial.__init__(self, parent)

        self.m_pixmap = QPixmap(":/bitmaps/dial_01d.png")
        self.m_pixmap_n_str = "01"
        self.m_custom_paint = 0

        self.m_hovered    = False
        self.m_hover_step = self.HOVER_MIN

        if self.m_pixmap.width() > self.m_pixmap.height():
            self.m_orientation = self.HORIZONTAL
        else:
            self.m_orientation = self.VERTICAL

        self.m_label = ""
        self.m_label_pos = QPointF(0.0, 0.0)
        self.m_label_width = 0
        self.m_label_height = 0
        self.m_label_gradient = QLinearGradient(0, 0, 0, 1)

        if self.palette().window().color().lightness() > 100:
            # Light background
            self.m_color1 = QColor(100, 100, 100, 255)
            self.m_color2 = QColor(0, 0, 0, 0)
            self.m_colorT = [self.palette().text().color(), self.palette().mid().color()]
        else:
            # Dark background
            self.m_color1 = QColor(0, 0, 0, 255)
            self.m_color2 = QColor(0, 0, 0, 0)
            self.m_colorT = [Qt.white, Qt.darkGray]

        self.updateSizes()
开发者ID:kayosiii,项目名称:Cadence,代码行数:33,代码来源:pixmapdial.py

示例12: mousePressEvent

    def mousePressEvent(self, event):
        if event.button() == Qt.MidButton:
            self.setCursor(QCursor(Qt.SizeAllCursor))
            self._lastPanPoint = event.pos()
            self._crossHairCursor.setVisible(False)
            self._dragMode = True
            if self._ticker.isActive():
                self._deltaPan = QPointF(0, 0)

        if event.buttons() == Qt.RightButton:
            #make sure that we have the cursor at the correct position
            #before we call the context menu
            self.mouseMoveEvent(event)
            self.customContextMenuRequested.emit(event.pos())
            return

        if not self.drawingEnabled:
            print "ImageView2D.mousePressEvent: drawing is not enabled"
            return
        
        if event.buttons() == Qt.LeftButton:
            #don't draw if flicker the view
            if self._ticker.isActive():
                return
            if QApplication.keyboardModifiers() == Qt.ShiftModifier:
                self.erasingToggled.emit(True)
                self._tempErase = True
            mousePos = self.mapToScene(event.pos())
            self.beginDrawing(mousePos)
开发者ID:lcroitor,项目名称:volumeeditor,代码行数:29,代码来源:imageView2D.py

示例13: distToLine

def distToLine(pt,  p1,  p2):
    """
    Compute the distance from the point `pt` to the line segment [p1,p2]
    """
    u = p2-p1
    lu = u.x()*u.x() + u.y()*u.y()
    pmax = QPointF(max(abs(p1.x()), abs(p2.x())), max(abs(p1.y()), abs(p2.y())))
    if lu / (pmax.x()*pmax.x() + pmax.y()*pmax.y()) < 1e-10:
        diff = u - p1
        return sqrt(diff.x()*diff.x() + diff.y()*diff.y())
    dp = pt-p1
    proj = (u.x()*dp.x() + u.y()*dp.y())
    if proj >= 0 and proj <= lu:
        return abs(dp.x()*u.y() - u.x()*dp.y())/sqrt(lu)
    elif proj < 0:
        return dp.x()*dp.x() + dp.y()*dp.y()
    else:
        return dist(pt,  p2)
开发者ID:PierreBdR,项目名称:point_tracker,代码行数:18,代码来源:geometry.py

示例14: path_link_disabled

def path_link_disabled(basepath):
    """
    Return a QPainterPath 'styled' to indicate a 'disabled' link.

    A disabled link is displayed with a single disconnection symbol in the
    middle (--||--)

    Parameters
    ----------
    basepath : QPainterPath
        The base path (a simple curve spine).

    Returns
    -------
    path : QPainterPath
        A 'styled' link path
    """
    segmentlen = basepath.length()
    px = 5

    if segmentlen < 10:
        return QPainterPath(basepath)

    t = (px / 2) / segmentlen
    p1, _ = qpainterpath_simple_split(basepath, 0.50 - t)
    _, p2 = qpainterpath_simple_split(basepath, 0.50 + t)

    angle = -basepath.angleAtPercent(0.5) + 90
    angler = math.radians(angle)
    normal = QPointF(math.cos(angler), math.sin(angler))

    end1 = p1.currentPosition()
    start2 = QPointF(p2.elementAt(0).x, p2.elementAt(0).y)
    p1.moveTo(start2.x(), start2.y())
    p1.addPath(p2)

    def QPainterPath_addLine(path, line):
        path.moveTo(line.p1())
        path.lineTo(line.p2())

    QPainterPath_addLine(p1, QLineF(end1 - normal * 3, end1 + normal * 3))
    QPainterPath_addLine(p1, QLineF(start2 - normal * 3, start2 + normal * 3))
    return p1
开发者ID:tomazc,项目名称:orange3,代码行数:43,代码来源:linkitem.py

示例15: __init__

 def __init__( self, scene ):
     self._visible               = True
     
     super(XNodeConnection, self).__init__()
     
     # define custom properties
     self._textItem              = None
     self._polygons              = []
     self._style                 = XConnectionStyle.Linear
     self._padding               = 20
     self._squashThreshold       = 2 * scene.cellWidth()
     self._showDirectionArrow    = False
     self._highlightPen          = QPen(QColor('yellow'))
     self._disabledPen           = QPen(QColor(100, 100, 100))
     self._disableWithLayer      = False
     self._enabled               = True
     self._dirty                 = True
     self._customData            = {}
     self._layer                 = None
     self._font                  = QApplication.instance().font()
     self._text                  = ''
     
     self._inputNode                     = None
     self._inputFixedY                   = None
     self._inputFixedX                   = None
     self._inputPoint                    = QPointF()
     self._inputLocation                 = XConnectionLocation.Left
     self._autoCalculateInputLocation    = False
     self._showInputArrow                = False
     
     self._outputNode                    = None
     self._outputFixedX                  = None
     self._outputFixedY                  = None
     self._outputPoint                   = QPointF()
     self._outputLocation                = XConnectionLocation.Right
     self._autoCalculateOutputLocation   = False
     self._showOutputArrow               = False
     
     # set standard properties
     self.setFlags( self.ItemIsSelectable )
     self.setZValue(-1)
     self.setPen( QColor('white') )
     self.setLayer( scene.currentLayer() )
开发者ID:satishgoda,项目名称:DPS_PIPELINE,代码行数:43,代码来源:xnodeconnection.py


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