def __init__(self, port, graph, hOffset, color, connectionPointType): super(PortCircle, self).__init__(port) self.__port = port self._graph = graph self._connectionPointType = connectionPointType self.__connections = set() self._supportsOnlySingleConnections = connectionPointType == 'In' self.setSizePolicy( QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)) size = QtCore.QSizeF(self.__diameter, self.__diameter) self.setPreferredSize(size) self.setWindowFrameMargins(0, 0, 0, 0) self.transform().translate(self.__radius * hOffset, 0) self.__defaultPen = QtGui.QPen(QtGui.QColor(25, 25, 25), 1.0) self.__hoverPen = QtGui.QPen(QtGui.QColor(255, 255, 100), 1.5) self._ellipseItem = QtWidgets.QGraphicsEllipseItem(self) self._ellipseItem.setPen(self.__defaultPen) self._ellipseItem.setPos(size.width() / 2, size.height() / 2) self._ellipseItem.setRect( -self.__radius, -self.__radius, self.__diameter, self.__diameter, ) if connectionPointType == 'In': self._ellipseItem.setStartAngle(270 * 16) self._ellipseItem.setSpanAngle(180 * 16) self.setColor(color) self.setAcceptHoverEvents(True)
def textSize(self): return QtCore.QSizeF( self.__textItem.textWidth(), self.__font.pointSizeF() + self.__labelBottomSpacing )
def textSize(self): return QtCore.QSizeF(self.__fontMetrics.width(self.__text), self.__fontMetrics.height())
def textSize(self): return QtCore.QSizeF(self.__textItem.textWidth(), self.textHeight())