Python PySide.QtCore 模块,QRectF() 实例源码

我们从Python开源项目中,提取了以下29个代码示例,用于说明如何使用PySide.QtCore.QRectF()

项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def drawBarChart(self, painter, Highlight): 
        radiusOld = 10

        width = float(radiusOld*2/self.slices)
        assert self.slices == len(self.ColorQ)
        setWidth = 0 
        j = -1 
        for i in range(self.slices): 
            if not(self.Highlight):
                painter.setPen(QtGui.QPen(QtCore.Qt.black, 0.1)) 
            else: 
                painter.setPen(QtGui.QPen(QtCore.Qt.blue, 1))  

            painter.setBrush(self.ColorQ[j])
            radius = (float(self.AlphaValue[j]/255)*20)
            rectangle = QtCore.QRectF(10-setWidth, 10, width, -radius);
            painter.drawRect(rectangle)
            setWidth += width 
            j = j-1
项目:OpenTimelineIO    作者:PixarAnimationStudios    | 项目源码 | 文件源码
def _populate(self):
        for n, item in enumerate(self.track):
            timeline_range = self.track.trimmed_range_of_child_at_index(n)

            rect = QtCore.QRectF(
                0,
                0,
                otio.opentime.to_seconds(timeline_range.duration) *
                TIME_MULTIPLIER,
                TRACK_HEIGHT
            )

            if isinstance(item, otio.schema.Clip):
                new_item = ClipItem(item, timeline_range, rect)
            elif isinstance(item, otio.schema.Stack):
                new_item = NestedItem(item, timeline_range, rect)
            elif isinstance(item, otio.schema.Track):
                new_item = NestedItem(item, timeline_range, rect)
            elif isinstance(item, otio.schema.Gap):
                new_item = GapItem(item, timeline_range, rect)
            elif isinstance(item, otio.schema.Transition):
                new_item = TransitionItem(item, timeline_range, rect)
            else:
                print("Warning: could not add item {} to UI.".format(item))
                continue

            new_item.setParentItem(self)
            new_item.setX(
                otio.opentime.to_seconds(timeline_range.start_time)
                * TIME_MULTIPLIER
            )
            new_item.counteract_zoom()
项目:OpenTimelineIO    作者:PixarAnimationStudios    | 项目源码 | 文件源码
def _add_track(self, track, y_pos):
        scene_rect = self.sceneRect()
        rect = QtCore.QRectF(0, 0, scene_rect.width() * 10, TRACK_HEIGHT)
        new_track = TrackWidget(track, rect)
        self.addItem(new_track)
        new_track.setPos(scene_rect.x(), y_pos)
项目:BrainModulyzer    作者:sugeerth    | 项目源码 | 文件源码
def scaleView(self, scaleFactor):
        factor = self.matrix().scale(scaleFactor, scaleFactor).mapRect(QtCore.QRectF(0, 0, 5, 5)).width()
        if factor < 0.07 or factor > 100:
            return
        self.scale(scaleFactor, scaleFactor)
        del factor
项目:BrainModulyzer    作者:sugeerth    | 项目源码 | 文件源码
def boundingRect(self):
        """
        Computes the bounding recatangle for every edge 
        """
        if not self.source() or not self.dest():
            return QtCore.QRectF()

        return QtCore.QRectF(self.sourcePoint,
                             QtCore.QSizeF(self.destPoint.x() - self.sourcePoint.x(),
                                           self.destPoint.y() - self.sourcePoint.y()))
项目:BrainModulyzer    作者:sugeerth    | 项目源码 | 文件源码
def boundingRect(self):
        adjust = 2.0
        return QtCore.QRectF(-45 - adjust, -45 - adjust,
                             75 + adjust, 75 + adjust)
项目:BrainModulyzer    作者:sugeerth    | 项目源码 | 文件源码
def boundingRect(self):
        """
        Computes the bounding recatangle for every edge 
        """
        if not self.source() or not self.dest():
            return QtCore.QRectF()

        return QtCore.QRectF(self.sourcePoint,
                             QtCore.QSizeF(self.destPoint.x() - self.sourcePoint.x(),
                                           self.destPoint.y() - self.sourcePoint.y()))
项目:BrainModulyzer    作者:sugeerth    | 项目源码 | 文件源码
def boundingRect(self):
        """
        Computes the bounding recatangle for every edge 
        """
        if not self.source() or not self.dest():
            return QtCore.QRectF()

        return QtCore.QRectF(self.sourcePoint,
                             QtCore.QSizeF(self.destPoint.x() - self.sourcePoint.x(),
                                           self.destPoint.y() - self.sourcePoint.y()))
项目:BrainModulyzer    作者:sugeerth    | 项目源码 | 文件源码
def scaleView(self, scaleFactor):
        factor = self.matrix().scale(scaleFactor, scaleFactor).mapRect(QtCore.QRectF(0, 0, 1, 1)).width()
        if factor < 0.07 or factor > 100:
            return
        self.scale(scaleFactor, scaleFactor)
        del factor
项目:BrainModulyzer    作者:sugeerth    | 项目源码 | 文件源码
def scaleView(self, scaleFactor):
        factor = self.matrix().scale(scaleFactor, scaleFactor).mapRect(QtCore.QRectF(0, 0, 1, 1)).width()
        if factor < 0.07 or factor > 100:
            return
        self.scale(scaleFactor, scaleFactor)
        del factor
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def boundingRect(self):
        adjust = 2.0
        return QtCore.QRectF(-40 - adjust, -40 - adjust,
                             70 + adjust, 70 + adjust)
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def boundingRect(self):
        adjust = 2.0
        return QtCore.QRectF(-40 - adjust, -40 - adjust,
                             70 + adjust, 70 + adjust)
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def boundingRect(self):
        adjust = 2.0
        return QtCore.QRectF(-40 - adjust, -40 - adjust,
                             70 + adjust, 70 + adjust)
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def boundingRect(self):
        """
        Computes the bounding recatangle for every edge 
        """
        if not self.source() or not self.dest():
            return QtCore.QRectF()

        return QtCore.QRectF(self.sourcePoint,
                             QtCore.QSizeF(self.destPoint.x() - self.sourcePoint.x(),
                                           self.destPoint.y() - self.sourcePoint.y()))
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def drawBackground(self, painter, rect):
        sceneRect = self.sceneRect()
        textRect = QtCore.QRectF(sceneRect.left() + 4, sceneRect.top() + 4,
                                 sceneRect.width() - 4, sceneRect.height() - 4)
        message = self.tr("Link Graph")

        font = painter.font()
        font.setBold(True)
        font.setPointSize(14)
        painter.setFont(font)
        painter.setPen(QtCore.Qt.lightGray)
        painter.drawText(textRect.translated(2, 2), message)
        painter.setPen(QtCore.Qt.black)
        painter.drawText(textRect, message)
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def scaleView(self, scaleFactor):
        factor = self.matrix().scale(scaleFactor, scaleFactor).mapRect(QtCore.QRectF(0, 0, 1, 1)).width()
        if factor < 0.07 or factor > 100:
            return
        self.scale(scaleFactor, scaleFactor)
        del factor
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def boundingRect(self):
        """
        Computes the bounding recatangle for every edge 
        """
        if not self.source() or not self.dest():
            return QtCore.QRectF()

        return QtCore.QRectF(self.sourcePoint,
                             QtCore.QSizeF(self.destPoint.x() - self.sourcePoint.x(),
                                           self.destPoint.y() - self.sourcePoint.y()))
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def boundingRect(self):
        adjust = 2.0
        return QtCore.QRectF(-45 - adjust, -45 - adjust,
                             75 + adjust, 75 + adjust)
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def boundingRect(self):
        adjust = 2.0
        return QtCore.QRectF(-45 - adjust, -45 - adjust,
                             75 + adjust, 75 + adjust)
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def UpdateColors(self):
        self.regenerateElectrodes(self.ElectrodeData.timeStep)
        for node in self.NodeIds:
            self.unselectNodes(node)
            try:
                temp = self.ElectrodeData.graphWidget.partition[node.counter]
            except IndexError:
                temp = 0 

            if self.ElectrodeData.ScalarSize: 
                Size = eval('self.ElectrodeData.graphWidget.'+self.ElectrodeData.electrodeSizeFactor+'[node.counter-1]')
                node.setNodeSize(Size,self.ElectrodeData.electrodeSizeFactor)
            else: 
                Size = 0.4 
                node.setNodeSize(Size,"nothing to Display")

            if not(self.ElectrodeData.nodeSizeFactor == 1):
                node.ScalarNodeSize(self.ElectrodeData.nodeSizeFactor)

        if self.ElectrodeData.Glyph:
            for node in self.NodeIds:
                node.setGlyph(True)

        if self.ElectrodeData.ElectrodeScreenshot:
            pixmap = QtGui.QImage(self.scene.sceneRect().size().toSize())
            pAin = QtGui.QPainter(pixmap)
            self.scene.render(pAin,QtCore.QRectF(self.width/4+50, self.height/4+50, 3*self.width/6,3*self.height/6))
            fileName = str("Time_"+str(self.ElectrodeData.timeStep)+"_Syllable_"+str(self.ElectrodeData.syllableUnit)+"_Alg_"+str(self.ElectrodeData.clusterActivated)+".png")
            pixmap1 = QtGui.QPixmap.fromImage(pixmap)
项目:ECoG-ClusterFlow    作者:sugeerth    | 项目源码 | 文件源码
def scaleView(self, scaleFactor):
        factor = self.matrix().scale(scaleFactor, scaleFactor).mapRect(QtCore.QRectF(0, 0, 1, 1)).width()
        if factor < 0.07 or factor > 100:
            return
        self.scale(scaleFactor, scaleFactor)
        del factor

    # def contextMenuEvent(self, event):
    #     menu = QtGfui.QMenu()
    #     testAction = QtGui.QAction('Refresh Screen', None)
    #     testAction.triggered.connect(self.RefreshInteractivityData)
    #     menu.addAction(testAction)
    #     # menu.exec_(event.globalPos())
项目:PipeLine    作者:draknova    | 项目源码 | 文件源码
def boundingRect(self):  
        minx = min(self.inputNode.outputPos().x(), self.outputNode.inputPos().x()) - 20
        miny = min(self.inputNode.outputPos().y(), self.outputNode.inputPos().y()) - 20

        maxx = max(self.inputNode.outputPos().x(), self.outputNode.inputPos().x()) + 20
        maxy = max(self.inputNode.outputPos().y(), self.outputNode.inputPos().y()) + 20

        self.rect = QtCore.QRectF(minx,miny,maxx-minx,maxy-miny)
        return self.rect
项目:PipeLine    作者:draknova    | 项目源码 | 文件源码
def boundingRect(self):
        self.rect = QtCore.QRectF(-self.size.x()/2,-self.size.y()/2,self.size.x(),self.size.y())
        return self.rect
项目:PipeLine    作者:draknova    | 项目源码 | 文件源码
def boundingRect(self):
        self.rect = QtCore.QRectF(-self.size.x()/2,-self.size.y()/2,self.size.x(),self.size.y())
        return self.rect
项目:kite    作者:pyrocko    | 项目源码 | 文件源码
def boundingRect(self):
        return QtCore.QRectF(self.p1, self.p2)
项目:kite    作者:pyrocko    | 项目源码 | 文件源码
def __init__(self, leaf):
        self.id = leaf.id
        QtCore.QRectF.__init__(
            self,
            QtCore.QPointF(leaf.llE, leaf.llN + leaf.sizeN),
            QtCore.QPointF(leaf.llE + leaf.sizeE, leaf.llN))
项目:kite    作者:pyrocko    | 项目源码 | 文件源码
def updateEraseBox(self, p1, p2):
        r = QtCore.QRectF(p1, p2)
        r = self.vb.childGroup.mapRectFromParent(r)
        self.eraseBox.r = r
        self.eraseBox.setPos(r.topLeft())
        self.eraseBox.resetTransform()
        self.eraseBox.scale(r.width(), r.height())
        self.eraseBox.show()
项目:kite    作者:pyrocko    | 项目源码 | 文件源码
def boundingRect(self):
        return QtCore.QRectF(0, 0, self.width(), self.height())
项目:pcbre    作者:pcbre    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        if len(args) == 2:
            self.width, self.height = args
        elif len(args) == 1 and isinstance(args[0], (QtCore.QRect, QtCore.QRectF)):
            self.width = args[0].width()
            self.width = args[0].height()
        elif len(args) == 1 and len(args[0]) == 2:
            self.width, self.height = args[0]
        elif len(kwargs) == 2 and "width" in kwargs and "height" in kwargs:
            self.width = kwargs["width"]
            self.height = kwards["height"]
        else:
            raise TypeError