Ignore:
Timestamp:
11/21/12 19:37:17 (17 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Changed annotation item selection and (control point) geometry editing.

Control point editing is now fixed to the items focus state.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/canvas/items/controlpoints.py

    r11172 r11192  
    109109    rectChanged = Signal(QRectF) 
    110110    rectEdited = Signal(QRectF) 
    111  
    112     editingStarted = Signal() 
    113     editingFinished = Signal() 
    114111 
    115112    def __init__(self, parent=None, rect=None, constraints=0, **kwargs): 
     
    193190        pass 
    194191 
    195     def focusInEvent(self, event): 
    196         QGraphicsObject.focusInEvent(self, event) 
    197         if event.isAccepted(): 
    198             self.editingStarted.emit() 
    199  
    200     def focusOutEvent(self, event): 
    201         QGraphicsObject.focusOutEvent(self, event) 
    202         if event.isAccepted(): 
    203             self.editingFinished.emit() 
     192    def isControlActive(self): 
     193        """Return the state of the control. True if the control is 
     194        active (user is dragging one of the points) False otherwise. 
     195 
     196        """ 
     197        return self.__activeControl is not None 
    204198 
    205199    def itemChange(self, change, value): 
     
    312306    lineEdited = Signal(QLineF) 
    313307 
    314     editingStarted = Signal() 
    315     editingFinished = Signal() 
    316  
    317308    def __init__(self, parent=None, **kwargs): 
    318309        QGraphicsObject.__init__(self, parent, **kwargs) 
     
    330321        if self.scene(): 
    331322            self.__installFilter() 
     323 
    332324        for p in self.__points: 
    333325            p.setFlag(QGraphicsItem.ItemIsFocusable) 
     
    346338        return self.__line 
    347339 
    348     def focusInEvent(self, event): 
    349         QGraphicsObject.focusInEvent(self, event) 
    350         if event.isAccepted(): 
    351             self.editingStarted.emit() 
    352  
    353     def focusOutEvent(self, event): 
    354         QGraphicsObject.focusOutEvent(self, event) 
    355         if event.isAccepted(): 
    356             self.editingFinished.emit() 
     340    def isControlActive(self): 
     341        """Return the state of the control. True if the control is 
     342        active (user is dragging one of the points) False otherwise. 
     343 
     344        """ 
     345        return self.__activeControl is not None 
    357346 
    358347    def __installFilter(self): 
Note: See TracChangeset for help on using the changeset viewer.