Ignore:
Timestamp:
01/25/13 10:58:18 (15 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

A fix/workaround for a strange behavior resulting in an infinite recursion.

I'am not discounting the possibility of a corrupted Qt build.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/gui/toolbox.py

    r11246 r11280  
    1919) 
    2020 
    21 from PyQt4.QtCore import Qt, QObject, QSize, QRect, QPoint, QSignalMapper 
     21from PyQt4.QtCore import ( 
     22    Qt, QObject, QSize, QRect, QPoint, QSignalMapper, QEvent 
     23) 
     24 
    2225from PyQt4.QtCore import pyqtSignal as Signal, pyqtProperty as Property 
    2326 
     
    191194 
    192195 
     196class _ToolBoxScrollArea(QScrollArea): 
     197    def eventFilter(self, obj, event): 
     198        if obj is self.widget() and event.type() == QEvent.Resize: 
     199            if event.size() == event.oldSize() and self.widgetResizable(): 
     200                # This is driving me insane. This should not have happened. 
     201                # Before the event is sent QWidget specifically makes sure the 
     202                # sizes are different, but somehow I still get this, and enter 
     203                # an infinite recursion if I enter QScrollArea.eventFilter. 
     204                # I can only duplicate this on one development machine a 
     205                # Mac OSX using fink and Qt 4.7.3 
     206                return False 
     207 
     208        return QScrollArea.eventFilter(self, obj, event) 
     209 
     210 
    193211class ToolBox(QFrame): 
    194212    """A tool box widget. 
     
    226244        # Scroll area for the contents. 
    227245        self.__scrollArea = \ 
    228                 QScrollArea(self, objectName="toolbox-scroll-area") 
     246                _ToolBoxScrollArea(self, objectName="toolbox-scroll-area") 
    229247 
    230248        self.__scrollArea.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn) 
Note: See TracChangeset for help on using the changeset viewer.