コード例 #1
0
ファイル: linkitem.py プロジェクト: www3838438/orange-canvas
    def __init__(self, *args):
        self.__boundingRect = None
        QGraphicsObject.__init__(self, *args)
        self.setFlag(QGraphicsItem.ItemHasNoContents, True)
        self.setAcceptedMouseButtons(Qt.RightButton | Qt.LeftButton)
        self.setAcceptHoverEvents(True)

        self.setZValue(self.Z_VALUE)

        self.sourceItem = None
        self.sourceAnchor = None
        self.sinkItem = None
        self.sinkAnchor = None

        self.curveItem = LinkCurveItem(self)

        self.sourceIndicator = LinkAnchorIndicator(self)
        self.sinkIndicator = LinkAnchorIndicator(self)
        self.sourceIndicator.hide()
        self.sinkIndicator.hide()

        self.linkTextItem = QGraphicsTextItem(self)
        self.linkTextItem.setAcceptedMouseButtons(Qt.NoButton)
        self.linkTextItem.setAcceptHoverEvents(False)
        self.__sourceName = ""
        self.__sinkName = ""

        self.__dynamic = False
        self.__dynamicEnabled = False
        self.__state = LinkItem.NoState
        self.hover = False

        self.prepareGeometryChange()
        self.__updatePen()
        self.__boundingRect = None
コード例 #2
0
ファイル: linkitem.py プロジェクト: rekonder/orange3
    def __init__(self, *args):
        self.__boundingRect = None
        QGraphicsObject.__init__(self, *args)
        self.setFlag(QGraphicsItem.ItemHasNoContents, True)
        self.setAcceptedMouseButtons(Qt.RightButton | Qt.LeftButton)
        self.setAcceptHoverEvents(True)

        self.setZValue(self.Z_VALUE)

        self.sourceItem = None
        self.sourceAnchor = None
        self.sinkItem = None
        self.sinkAnchor = None

        self.curveItem = LinkCurveItem(self)

        self.sourceIndicator = LinkAnchorIndicator(self)
        self.sinkIndicator = LinkAnchorIndicator(self)
        self.sourceIndicator.hide()
        self.sinkIndicator.hide()

        self.linkTextItem = QGraphicsTextItem(self)

        self.__sourceName = ""
        self.__sinkName = ""

        self.__dynamic = False
        self.__dynamicEnabled = False
        self.__state = LinkItem.Empty
        self.hover = False

        self.prepareGeometryChange()
        self.__updatePen()
        self.__boundingRect = None
コード例 #3
0
ファイル: layout.py プロジェクト: PrimozGodec/orange3
    def __init__(self, parent=None, **kwargs):
        QGraphicsObject.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsObject.ItemHasNoContents)

        self.__layoutPending = False
        self.__isActive = False
        self.__invalidatedAnchors = []
        self.__enabled = True
コード例 #4
0
    def __init__(self, parent=None, **kwargs):
        QGraphicsObject.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsObject.ItemSendsGeometryChanges)

        self.__path = QPainterPath()
        self.__brush = QBrush(Qt.NoBrush)
        self.__pen = QPen()
        self.__boundingRect = None
コード例 #5
0
    def __init__(self, parent=None, **kwargs):
        QGraphicsObject.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsObject.ItemHasNoContents)

        self.__layoutPending = False
        self.__isActive = False
        self.__invalidatedAnchors = []
        self.__enabled = True
コード例 #6
0
    def __init__(self, parent=None, **kwargs):
        QGraphicsObject.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsObject.ItemSendsGeometryChanges)

        self.__path = QPainterPath()
        self.__brush = QBrush(Qt.NoBrush)
        self.__pen = QPen()
        self.__boundingRect = None
コード例 #7
0
ファイル: owlegend.py プロジェクト: RachitKansal/orange3
 def __init__(self, text, parent):
     QGraphicsObject.__init__(self, parent)
     self.text_item = QGraphicsTextItem(text + ':', self)
     f = self.text_item.font()
     f.setBold(True)
     self.text_item.setFont(f)
     self.rect_item = QGraphicsRectItem(self.text_item.boundingRect(), self)
     self.rect_item.setPen(QPen(Qt.NoPen))
     self.rect_item.stackBefore(self.text_item)
コード例 #8
0
 def __init__(self, text, parent):
     QGraphicsObject.__init__(self, parent)
     self.text_item = QGraphicsTextItem(text + ':', self)
     f = self.text_item.font()
     f.setBold(True)
     self.text_item.setFont(f)
     self.rect_item = QGraphicsRectItem(self.text_item.boundingRect(), self)
     self.rect_item.setPen(QPen(Qt.NoPen))
     self.rect_item.stackBefore(self.text_item)
コード例 #9
0
ファイル: linkitem.py プロジェクト: rekonder/orange3
 def hoverEnterEvent(self, event):
     # Hover enter event happens when the mouse enters any child object
     # but we only want to show the 'hovered' shadow when the mouse
     # is over the 'curveItem', so we install self as an event filter
     # on the LinkCurveItem and listen to its hover events.
     self.curveItem.installSceneEventFilter(self)
     return QGraphicsObject.hoverEnterEvent(self, event)
コード例 #10
0
    def itemChange(self, change, value):
        if change == QGraphicsObject.ItemPositionHasChanged:
            pos = qunwrap(value)
            self.positionChanged.emit()
            self.positionChanged[QPointF].emit(pos)

        return QGraphicsObject.itemChange(self, change, value)
コード例 #11
0
ファイル: linkitem.py プロジェクト: www3838438/orange-canvas
 def hoverEnterEvent(self, event):
     # Hover enter event happens when the mouse enters any child object
     # but we only want to show the 'hovered' shadow when the mouse
     # is over the 'curveItem', so we install self as an event filter
     # on the LinkCurveItem and listen to its hover events.
     self.curveItem.installSceneEventFilter(self)
     return QGraphicsObject.hoverEnterEvent(self, event)
コード例 #12
0
    def itemChange(self, change, value):
        if change == QGraphicsItem.ItemSelectedChange:
            self.shapeItem.setSelected(value)
            self.captionTextItem.setSelectionState(value)
        elif change == QGraphicsItem.ItemPositionHasChanged:
            self.positionChanged.emit()

        return QGraphicsObject.itemChange(self, change, value)
コード例 #13
0
ファイル: linkitem.py プロジェクト: www3838438/orange-canvas
    def sceneEventFilter(self, obj, event):
        if obj is self.curveItem:
            if event.type() == QEvent.GraphicsSceneHoverEnter:
                self.setHoverState(True)
            elif event.type() == QEvent.GraphicsSceneHoverLeave:
                self.setHoverState(False)

        return QGraphicsObject.sceneEventFilter(self, obj, event)
コード例 #14
0
ファイル: linkitem.py プロジェクト: rekonder/orange3
    def sceneEventFilter(self, obj, event):
        if obj is self.curveItem:
            if event.type() == QEvent.GraphicsSceneHoverEnter:
                self.setHoverState(True)
            elif event.type() == QEvent.GraphicsSceneHoverLeave:
                self.setHoverState(False)

        return QGraphicsObject.sceneEventFilter(self, obj, event)
コード例 #15
0
ファイル: owlegend.py プロジェクト: RachitKansal/orange3
    def __init__(self, palette, values, parent):
        QGraphicsObject.__init__(self, parent)
        self.parent = parent
        self.palette = palette
        self.values = values
        self.legend = parent
        self.label_items = [QGraphicsTextItem(text, self) for text in values]
        for i in self.label_items:
            i.setTextWidth(50)

        self.rect = QRectF()

        self.gradient_item = QGraphicsRectItem(self)
        self.gradient = QLinearGradient()
        self.gradient.setStops([(v*0.1, self.palette[v*0.1]) for v in range(11) ])
        self.orientation = Qt.Horizontal
        self.set_orientation(Qt.Vertical)
コード例 #16
0
ファイル: nodeitem.py プロジェクト: RachitKansal/orange3
    def itemChange(self, change, value):
        if change == QGraphicsItem.ItemSelectedChange:
            self.shapeItem.setSelected(value)
            self.captionTextItem.setSelectionState(value)
        elif change == QGraphicsItem.ItemPositionHasChanged:
            self.positionChanged.emit()

        return QGraphicsObject.itemChange(self, change, value)
コード例 #17
0
    def __init__(self, palette, values, parent):
        QGraphicsObject.__init__(self, parent)
        self.parent = parent
        self.palette = palette
        self.values = values
        self.legend = parent
        self.label_items = [QGraphicsTextItem(text, self) for text in values]
        for i in self.label_items:
            i.setTextWidth(50)

        self.rect = QRectF()

        self.gradient_item = QGraphicsRectItem(self)
        self.gradient = QLinearGradient()
        self.gradient.setStops([(v * 0.1, self.palette[v * 0.1])
                                for v in range(11)])
        self.orientation = Qt.Horizontal
        self.set_orientation(Qt.Vertical)
コード例 #18
0
ファイル: nodeitem.py プロジェクト: www3838438/orange-canvas
    def itemChange(self, change, value):
        if change == QGraphicsItem.ItemSelectedChange:
            selected = bool(qtcompat.qunwrap(value))
            self.shapeItem.setSelected(selected)
            self.captionTextItem.setSelectionState(selected)
            self.backgroundItem.setVisible(selected)
        elif change == QGraphicsItem.ItemPositionHasChanged:
            self.positionChanged.emit()

        return QGraphicsObject.itemChange(self, change, value)
コード例 #19
0
ファイル: controlpoints.py プロジェクト: PrimozGodec/orange3
    def __init__(self, parent=None, **kwargs):
        QGraphicsObject.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsItem.ItemHasNoContents)
        self.setFlag(QGraphicsItem.ItemIsFocusable)

        self.__line = QLineF()
        self.__points = \
            [ControlPoint(self, ControlPoint.TopLeft),  # TopLeft is line start
             ControlPoint(self, ControlPoint.BottomRight)  # line end
             ]

        self.__activeControl = None

        if self.scene():
            self.__installFilter()

        for p in self.__points:
            p.setFlag(QGraphicsItem.ItemIsFocusable)
            p.setFocusProxy(self)
コード例 #20
0
ファイル: nodeitem.py プロジェクト: www3838438/orange-canvas
    def __init__(self, widget_description=None, parent=None, **kwargs):
        self.__boundingRect = None
        QGraphicsObject.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsItem.ItemSendsGeometryChanges, True)
        self.setFlag(QGraphicsItem.ItemHasNoContents, True)
        self.setFlag(QGraphicsItem.ItemIsSelectable, True)
        self.setFlag(QGraphicsItem.ItemIsMovable, True)
        self.setFlag(QGraphicsItem.ItemIsFocusable, True)

        # central body shape item
        self.shapeItem = None

        # in/output anchor items
        self.inputAnchorItem = None
        self.outputAnchorItem = None

        # title text item
        self.captionTextItem = None

        # error, warning, info items
        self.errorItem = None
        self.warningItem = None
        self.infoItem = None

        # background when selected
        self.backgroundItem = None

        self.__title = ""
        self.__processingState = 0
        self.__progress = -1
        self.__statusMessage = ""

        self.__error = None
        self.__warning = None
        self.__info = None

        self.__anchorLayout = None
        self.__animationEnabled = False

        self.setZValue(self.Z_VALUE)
        self.setupGraphics()

        self.setWidgetDescription(widget_description)
コード例 #21
0
    def __init__(self, parent=None, **kwargs):
        QGraphicsObject.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsItem.ItemHasNoContents)
        self.setFlag(QGraphicsItem.ItemIsFocusable)

        self.__line = QLineF()
        self.__points = [
            ControlPoint(self, ControlPoint.TopLeft),  # TopLeft is line start
            ControlPoint(self, ControlPoint.BottomRight),  # line end
        ]

        self.__activeControl = None

        if self.scene():
            self.__installFilter()

        for p in self.__points:
            p.setFlag(QGraphicsItem.ItemIsFocusable)
            p.setFocusProxy(self)
コード例 #22
0
ファイル: owlegend.py プロジェクト: RachitKansal/orange3
 def __init__(self, name, point, parent):
     QGraphicsObject.__init__(self, parent)
     self.text_item = QGraphicsTextItem(name, self)
     if point:
         s = point.size()
         height = max(2*s, self.text_item.boundingRect().height())
     else:
         height = self.text_item.boundingRect().height()
     p = 0.5 * height
     self.text_item.setPos(height, 0)
     self.point_item = point
     if point:
         self.point_item.setParentItem(self)
         self.point_item.setPos(p, p)
     self._rect = QRectF(0, 0, height + self.text_item.boundingRect().width(), height )
     self.rect_item = QGraphicsRectItem(self._rect, self)
     self.rect_item.setPen(QPen(Qt.NoPen))
     self.rect_item.stackBefore(self.text_item)
     if self.point_item:
         self.rect_item.stackBefore(self.point_item)
コード例 #23
0
ファイル: nodeitem.py プロジェクト: RachitKansal/orange3
    def __init__(self, widget_description=None, parent=None, **kwargs):
        self.__boundingRect = None
        QGraphicsObject.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsItem.ItemSendsGeometryChanges, True)
        self.setFlag(QGraphicsItem.ItemHasNoContents, True)
        self.setFlag(QGraphicsItem.ItemIsSelectable, True)
        self.setFlag(QGraphicsItem.ItemIsMovable, True)
        self.setFlag(QGraphicsItem.ItemIsFocusable, True)

        # central body shape item
        self.shapeItem = None

        # in/output anchor items
        self.inputAnchorItem = None
        self.outputAnchorItem = None

        # title text item
        self.captionTextItem = None

        # error, warning, info items
        self.errorItem = None
        self.warningItem = None
        self.infoItem = None

        self.__title = ""
        self.__processingState = 0
        self.__progress = -1
        self.__statusMessage = ""

        self.__error = None
        self.__warning = None
        self.__info = None

        self.__anchorLayout = None
        self.__animationEnabled = False

        self.setZValue(self.Z_VALUE)
        self.setupGraphics()

        self.setWidgetDescription(widget_description)
コード例 #24
0
 def __init__(self, name, point, parent):
     QGraphicsObject.__init__(self, parent)
     self.text_item = QGraphicsTextItem(name, self)
     if point:
         s = point.size()
         height = max(2 * s, self.text_item.boundingRect().height())
     else:
         height = self.text_item.boundingRect().height()
     p = 0.5 * height
     self.text_item.setPos(height, 0)
     self.point_item = point
     if point:
         self.point_item.setParentItem(self)
         self.point_item.setPos(p, p)
     self._rect = QRectF(0, 0,
                         height + self.text_item.boundingRect().width(),
                         height)
     self.rect_item = QGraphicsRectItem(self._rect, self)
     self.rect_item.setPen(QPen(Qt.NoPen))
     self.rect_item.stackBefore(self.text_item)
     if self.point_item:
         self.rect_item.stackBefore(self.point_item)
コード例 #25
0
    def sceneEventFilter(self, obj, event):
        try:
            obj = toGraphicsObjectIfPossible(obj)
            if isinstance(obj, ControlPoint):
                etype = event.type()
                if etype == QEvent.GraphicsSceneMousePress:
                    self.__setActiveControl(obj)
                elif etype == QEvent.GraphicsSceneMouseRelease:
                    self.__setActiveControl(None)

            return QGraphicsObject.sceneEventFilter(self, obj, event)
        except Exception:
            log.error("", exc_info=True)
コード例 #26
0
ファイル: controlpoints.py プロジェクト: PrimozGodec/orange3
    def sceneEventFilter(self, obj, event):
        try:
            obj = toGraphicsObjectIfPossible(obj)
            if isinstance(obj, ControlPoint):
                etype = event.type()
                if etype == QEvent.GraphicsSceneMousePress:
                    self.__setActiveControl(obj)
                elif etype == QEvent.GraphicsSceneMouseRelease:
                    self.__setActiveControl(None)

            return QGraphicsObject.sceneEventFilter(self, obj, event)
        except Exception:
            log.error("", exc_info=True)
コード例 #27
0
ファイル: controlpoints.py プロジェクト: PrimozGodec/orange3
    def __init__(self, parent=None, rect=None, constraints=0, **kwargs):
        QGraphicsObject.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsItem.ItemHasNoContents)
        self.setFlag(QGraphicsItem.ItemIsFocusable)

        self.__rect = rect if rect is not None else QRectF()
        self.__margins = QMargins()
        points = \
            [ControlPoint(self, ControlPoint.Left),
             ControlPoint(self, ControlPoint.Top),
             ControlPoint(self, ControlPoint.TopLeft),
             ControlPoint(self, ControlPoint.Right),
             ControlPoint(self, ControlPoint.TopRight),
             ControlPoint(self, ControlPoint.Bottom),
             ControlPoint(self, ControlPoint.BottomLeft),
             ControlPoint(self, ControlPoint.BottomRight)
             ]
        assert(points == sorted(points, key=lambda p: p.anchor()))

        self.__points = dict((p.anchor(), p) for p in points)

        if self.scene():
            self.__installFilter()

        for p in points:
            p.setFlag(QGraphicsItem.ItemIsFocusable)
            p.setFocusProxy(self)

        self.controlPoint(ControlPoint.Top).setConstraint(Qt.Vertical)
        self.controlPoint(ControlPoint.Bottom).setConstraint(Qt.Vertical)
        self.controlPoint(ControlPoint.Left).setConstraint(Qt.Horizontal)
        self.controlPoint(ControlPoint.Right).setConstraint(Qt.Horizontal)

        self.__constraints = constraints
        self.__activeControl = None

        self.__pointsLayout()
コード例 #28
0
    def __init__(self, parent=None, rect=None, constraints=0, **kwargs):
        QGraphicsObject.__init__(self, parent, **kwargs)
        self.setFlag(QGraphicsItem.ItemHasNoContents)
        self.setFlag(QGraphicsItem.ItemIsFocusable)

        self.__rect = rect if rect is not None else QRectF()
        self.__margins = QMargins()
        points = [
            ControlPoint(self, ControlPoint.Left),
            ControlPoint(self, ControlPoint.Top),
            ControlPoint(self, ControlPoint.TopLeft),
            ControlPoint(self, ControlPoint.Right),
            ControlPoint(self, ControlPoint.TopRight),
            ControlPoint(self, ControlPoint.Bottom),
            ControlPoint(self, ControlPoint.BottomLeft),
            ControlPoint(self, ControlPoint.BottomRight),
        ]
        assert points == sorted(points, key=lambda p: p.anchor())

        self.__points = dict((p.anchor(), p) for p in points)

        if self.scene():
            self.__installFilter()

        for p in points:
            p.setFlag(QGraphicsItem.ItemIsFocusable)
            p.setFocusProxy(self)

        self.controlPoint(ControlPoint.Top).setConstraint(Qt.Vertical)
        self.controlPoint(ControlPoint.Bottom).setConstraint(Qt.Vertical)
        self.controlPoint(ControlPoint.Left).setConstraint(Qt.Horizontal)
        self.controlPoint(ControlPoint.Right).setConstraint(Qt.Horizontal)

        self.__constraints = constraints
        self.__activeControl = None

        self.__pointsLayout()
コード例 #29
0
ファイル: owlegend.py プロジェクト: RachitKansal/orange3
 def __init__(self, graph, scene):
     QGraphicsObject.__init__(self)
     if scene:
         scene.addItem(self)
     self.graph = graph
     self.curves = []
     self.items = {}
     self.attributes = []
     self.point_attrs = {}
     self.point_vals = {}
     self.default_values = {
                            PointColor : Qt.black,
                            PointSize : 8,
                            PointSymbol : OWPoint.Ellipse
                            }
     self.box_rect = QRectF()
     self.setFiltersChildEvents(True)
     self.setFlag(self.ItemHasNoContents, True)
     self.mouse_down = False
     self._orientation = Qt.Vertical
     self.max_size = QSizeF()
     self._floating = True
     self._floating_animation = None
     self._mouse_down_pos = QPointF()
コード例 #30
0
 def __init__(self, graph, scene):
     QGraphicsObject.__init__(self)
     if scene:
         scene.addItem(self)
     self.graph = graph
     self.curves = []
     self.items = {}
     self.attributes = []
     self.point_attrs = {}
     self.point_vals = {}
     self.default_values = {
         PointColor: Qt.black,
         PointSize: 8,
         PointSymbol: OWPoint.Ellipse
     }
     self.box_rect = QRectF()
     self.setFiltersChildEvents(True)
     self.setFlag(self.ItemHasNoContents, True)
     self.mouse_down = False
     self._orientation = Qt.Vertical
     self.max_size = QSizeF()
     self._floating = True
     self._floating_animation = None
     self._mouse_down_pos = QPointF()
コード例 #31
0
    def sceneEventFilter(self, obj, event):
        try:
            obj = toGraphicsObjectIfPossible(obj)
            if isinstance(obj, ControlPoint):
                etype = event.type()
                if (etype == QEvent.GraphicsSceneMousePress
                        and event.button() == Qt.LeftButton):
                    self.__setActiveControl(obj)

                elif (etype == QEvent.GraphicsSceneMouseRelease
                      and event.button() == Qt.LeftButton):
                    self.__setActiveControl(None)

        except Exception:
            log.error("Error in 'ControlPointRect.sceneEventFilter'",
                      exc_info=True)

        return QGraphicsObject.sceneEventFilter(self, obj, event)
コード例 #32
0
ファイル: nodeitem.py プロジェクト: PrimozGodec/orange3
 def itemChange(self, change, value):
     if change == QGraphicsItem.ItemScenePositionHasChanged:
         self.scenePositionChanged.emit(value)
     return QGraphicsObject.itemChange(self, change, value)
コード例 #33
0
ファイル: nodeitem.py プロジェクト: PrimozGodec/orange3
    def __init__(self, *args):
        QGraphicsObject.__init__(self, *args)
        self.setFlag(QGraphicsItem.ItemSendsScenePositionChanges, True)
        self.setFlag(QGraphicsItem.ItemHasNoContents, True)

        self.__direction = QPointF()
コード例 #34
0
ファイル: nodeitem.py プロジェクト: RachitKansal/orange3
 def contextMenuEvent(self, event):
     if self.shapeItem.path().contains(event.pos()):
         return QGraphicsObject.contextMenuEvent(self, event)
     else:
         event.ignore()
コード例 #35
0
ファイル: nodeitem.py プロジェクト: RachitKansal/orange3
 def mouseDoubleClickEvent(self, event):
     if self.shapeItem.path().contains(event.pos()):
         QGraphicsObject.mouseDoubleClickEvent(self, event)
         QTimer.singleShot(0, self.activated.emit)
     else:
         event.ignore()
コード例 #36
0
ファイル: controlpoints.py プロジェクト: PrimozGodec/orange3
 def itemChange(self, change, value):
     if change == QGraphicsItem.ItemSceneHasChanged:
         if self.scene():
             self.__installFilter()
     return QGraphicsObject.itemChange(self, change, value)
コード例 #37
0
ファイル: nodeitem.py プロジェクト: www3838438/orange-canvas
 def focusOutEvent(self, event):
     self.shapeItem.setHasFocus(False)
     return QGraphicsObject.focusOutEvent(self, event)
コード例 #38
0
ファイル: nodeitem.py プロジェクト: www3838438/orange-canvas
 def focusInEvent(self, event):
     self.shapeItem.setHasFocus(True)
     return QGraphicsObject.focusInEvent(self, event)
コード例 #39
0
    def itemChange(self, change, value):
        if change == QGraphicsObject.ItemPositionHasChanged:
            self.positionChanged.emit()
            self.positionChanged[QPointF].emit(value)

        return QGraphicsObject.itemChange(self, change, value)
コード例 #40
0
ファイル: nodeitem.py プロジェクト: RachitKansal/orange3
 def mousePressEvent(self, event):
     if self.shapeItem.path().contains(event.pos()):
         return QGraphicsObject.mousePressEvent(self, event)
     else:
         event.ignore()
コード例 #41
0
ファイル: linkitem.py プロジェクト: www3838438/orange-canvas
 def hoverLeaveEvent(self, event):
     # Remove the event filter to prevent unnecessary work in
     # scene event filter when not needed
     self.curveItem.removeSceneEventFilter(self)
     return QGraphicsObject.hoverLeaveEvent(self, event)
コード例 #42
0
ファイル: nodeitem.py プロジェクト: zhoubo3666/orange3
    def __init__(self, *args):
        QGraphicsObject.__init__(self, *args)
        self.setFlag(QGraphicsItem.ItemSendsScenePositionChanges, True)
        self.setFlag(QGraphicsItem.ItemHasNoContents, True)

        self.__direction = QPointF()
コード例 #43
0
ファイル: nodeitem.py プロジェクト: zhoubo3666/orange3
 def itemChange(self, change, value):
     if change == QGraphicsItem.ItemScenePositionHasChanged:
         self.scenePositionChanged.emit(value)
     return QGraphicsObject.itemChange(self, change, value)
コード例 #44
0
 def itemChange(self, change, value):
     if change == QGraphicsItem.ItemSceneHasChanged:
         if self.scene():
             self.__installFilter()
     return QGraphicsObject.itemChange(self, change, value)
コード例 #45
0
ファイル: nodeitem.py プロジェクト: RachitKansal/orange3
 def focusOutEvent(self, event):
     self.shapeItem.setHasFocus(False)
     return QGraphicsObject.focusOutEvent(self, event)
コード例 #46
0
ファイル: layout.py プロジェクト: PrimozGodec/orange3
    def event(self, event):
        if event.type() == QEvent.LayoutRequest:
            self.activate()
            return True

        return QGraphicsObject.event(self, event)
コード例 #47
0
ファイル: nodeitem.py プロジェクト: RachitKansal/orange3
 def focusInEvent(self, event):
     self.shapeItem.setHasFocus(True)
     return QGraphicsObject.focusInEvent(self, event)
コード例 #48
0
ファイル: linkitem.py プロジェクト: rekonder/orange3
 def hoverLeaveEvent(self, event):
     # Remove the event filter to prevent unnecessary work in
     # scene event filter when not needed
     self.curveItem.removeSceneEventFilter(self)
     return QGraphicsObject.hoverLeaveEvent(self, event)
コード例 #49
0
ファイル: nodeitem.py プロジェクト: www3838438/orange-canvas
 def mousePressEvent(self, event):
     if self.shapeItem.path().contains(event.pos()):
         return QGraphicsObject.mousePressEvent(self, event)
     else:
         event.ignore()
コード例 #50
0
ファイル: nodeitem.py プロジェクト: www3838438/orange-canvas
 def contextMenuEvent(self, event):
     if self.shapeItem.path().contains(event.pos()):
         return QGraphicsObject.contextMenuEvent(self, event)
     else:
         event.ignore()
コード例 #51
0
ファイル: nodeitem.py プロジェクト: www3838438/orange-canvas
 def mouseDoubleClickEvent(self, event):
     if self.shapeItem.path().contains(event.pos()):
         QGraphicsObject.mouseDoubleClickEvent(self, event)
         QTimer.singleShot(0, self.activated.emit)
     else:
         event.ignore()
コード例 #52
0
    def event(self, event):
        if event.type() == QEvent.LayoutRequest:
            self.activate()
            return True

        return QGraphicsObject.event(self, event)