Ignore:
Timestamp:
05/10/13 14:33:44 (12 months ago)
Author:
markotoplak
Branch:
default
Message:

quickmenu sloppy regions get updated with mouse moves on the same icon, delay decreased, slight shape changes.

File:
1 edited

Legend:

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

    r11501 r11504  
    622622        p1 = current + QPoint(0, 2) 
    623623        p2 = current + QPoint(0, -2) 
    624         p3 = self.pos() + QPoint(self.width(), 0) 
    625         p4 = self.pos() + QPoint(self.width(), self.height()) 
     624        p3 = self.pos() + QPoint(self.width()+10, 0) 
     625        p4 = self.pos() + QPoint(self.width()+10, self.height()) 
    626626        return QRegion(QPolygon([p1, p2, p3, p4])) 
    627627 
     
    632632 
    633633        """ 
    634         self.__sloppyButton = button 
    635         delay = self.style().styleHint(QStyle.SH_Menu_SubMenuPopupDelay, None) 
    636         # The delay timeout is the same as used by Qt in the QMenu. 
    637         self.__sloppyTimer.start(delay * 6) 
     634        if not button.isChecked(): 
     635            self.__sloppyButton = button 
     636            delay = self.style().styleHint(QStyle.SH_Menu_SubMenuPopupDelay, None) 
     637            # The delay timeout is the same as used by Qt in the QMenu. 
     638            self.__sloppyTimer.start(delay) 
     639        else: 
     640            self.__sloppyTimer.stop() 
    638641 
    639642    def __onSloppyTimeout(self): 
     
    644647                index = [tab.button for tab in self.__tabs].index(button) 
    645648                self.setCurrentIndex(index) 
    646  
    647                 # Update the sloppy region from the current cursor position. 
    648                 current = self.mapFromGlobal(QCursor.pos()) 
    649                 if self.contentsRect().contains(current): 
    650                     self.__sloppyRegion = self.__calcSloppyRegion(current) 
    651649 
    652650    def eventFilter(self, receiver, event): 
     
    660658                    index = [tab.button for tab in self.__tabs].index(receiver) 
    661659                    self.setCurrentIndex(index) 
    662                     self.__sloppyRegion = self.__calcSloppyRegion(pos) 
     660                #also update sloppy region if mouse is moved on the same icon 
     661                self.__sloppyRegion = self.__calcSloppyRegion(pos) 
    663662 
    664663        return QWidget.eventFilter(self, receiver, event) 
Note: See TracChangeset for help on using the changeset viewer.