Ignore:
Timestamp:
11/23/12 18:43:01 (17 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Added quick menu trigger flags (default is double click and space key).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/document/interactions.py

    r11196 r11198  
    497497    def mousePressEvent(self, event): 
    498498        if event.button() == Qt.RightButton: 
    499             self.create_new(event) 
     499            self.create_new(event.screenPos()) 
    500500            self.end() 
    501501 
    502     def create_new(self, event): 
    503         """Create a new widget with a QuickWidgetMenu 
    504         """ 
    505         pos = event.screenPos() 
     502    def create_new(self, pos): 
     503        """Create a new widget with a QuickWidgetMenu at `pos` 
     504        (in screen coordinates). 
     505 
     506        """ 
    506507        menu = self.document.quickMenu() 
    507508        menu.setFilterFunc(None) 
     
    511512            item = action.property("item").toPyObject() 
    512513            desc = item.data(QtWidgetRegistry.WIDGET_DESC_ROLE).toPyObject() 
    513             pos = event.scenePos() 
     514            # Get the scene position 
     515            view = self.document.view() 
     516            pos = view.mapToScene(view.mapFromGlobal(pos)) 
    514517            node = scheme.SchemeNode(desc, position=(pos.x(), pos.y())) 
    515518            self.document.addNode(node) 
     
    523526        UserInteraction.__init__(self, document, *args, **kwargs) 
    524527        self.initial_selection = None 
     528        self.selection_rect = None 
    525529 
    526530    def mousePressEvent(self, event): 
Note: See TracChangeset for help on using the changeset viewer.