Changeset 8428:5d4949c7c5d7 in orange


Ignore:
Timestamp:
07/23/11 16:38:47 (3 years ago)
Author:
Noughmad <Noughmad@…>
Branch:
default
Convert:
ec32045aecc614dc819938b50dedc15467e707f5
Message:

Prevent the legend to be 'left behing' while dragging it

Location:
orange/OrangeWidgets/plot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/plot/owlegend.py

    r8423 r8428  
    2626        self.box_rect = QRectF() 
    2727        self.setFiltersChildEvents(True) 
     28        self.setFlag(self.ItemHasNoContents, True) 
     29        self.mouse_down = False 
    2830         
    2931    def clear(self): 
     
    99101             
    100102    def mousePressEvent(self, event): 
     103        self.setCursor(Qt.DragMoveCursor) 
     104        self.mouse_down = True 
     105        event.accept() 
     106         
     107    def mouseReleaseEvent(self, event): 
     108        self.unsetCursor() 
     109        self.mouse_down = False 
    101110        event.accept() 
    102111 
  • orange/OrangeWidgets/plot/owplot.py

    r8427 r8428  
    596596         
    597597        point = self.mapToScene(event.pos()) 
     598         
     599        ## We implement a workaround here, because sometimes mouseMoveEvents are not fast enough 
     600        ## so the moving legend gets left behind while dragging, and it's left in a pressed state 
     601        if self._legend.mouse_down: 
     602            QGraphicsView.mouseMoveEvent(self, event) 
     603            return 
     604         
    598605                 
    599606        if self._pressed_mouse_button == Qt.LeftButton: 
Note: See TracChangeset for help on using the changeset viewer.