def resizeEvent(self, event): """ Reimplementation of the resizeEvent handler. It determines if the frame is being resized by the splitter (allowed) or programmably via a resize of the part window (not allowed). """ if self.parent.resizeTimer.isActive(): # LeftFrame is being resized (programmably) by the part window # as the user drags the resize handle. # We don't want that, so don't change the splitter position. return # LeftFrame is most likely being resized by the user via the splitter, # but it is also possible that the user clicked the maximize/restore # button. If the user did this, set the splitter position to the # "old" width (not the current width) since it has been changed # programmably (and we didn't want that). size = event.size() oldSize = event.oldSize() delta = abs(size.width() - oldSize.width()) if delta < 10: # 10 pixels. Value chosen based on experimentation. self.parent.splitterPosition = size.width() if _DEBUG: print "New Size: ", self.parent.splitterPosition else: self.parent.splitterPosition = oldSize.width() if _DEBUG: print "Old Size: ", self.parent.splitterPosition QWidget.resizeEvent(self, event) return
def resizeEvent(self, event): """ This reimplementation of QWidget.resizeEvent is here to deal with the undesired behavior of the splitter while resizing the part window. Normally, the splitter will drift back and forth while resizing the part window. This forces the splitter to stay fixed during resize operations. """ # When self.resizeTimer.isActive() = True, the partwindow is being # resized. This is checked by the resizeEvent handler in LeftFrame # to determine if the splitter is being moved by the user or # programmably by self's resizeEvent. if self.resizeTimer.isActive(): self.resizeTimer.stop() # Stop the timer. self.resizeTimer.start(500) # (Re)strand a .5 second singleshot timer. self.setSplitterPosition(self.splitterPosition, setDefault=False) QWidget.resizeEvent(self, event) return
def resizeEvent(self, event): """ This reimplementation of QWidget.resizeEvent is here to deal with the undesired behavior of the splitter while resizing the part window. Normally, the splitter will drift back and forth while resizing the part window. This forces the splitter to stay fixed during resize operations. """ # When self.resizeTimer.isActive() = True, the partwindow is being # resized. This is checked by the resizeEvent handler in LeftFrame # to determine if the splitter is being moved by the user or # programmably by self's resizeEvent. if self.resizeTimer.isActive(): self.resizeTimer.stop() # Stop the timer. self.resizeTimer.start( 500 ) # (Re)strand a .5 second singleshot timer. self.setSplitterPosition(self.splitterPosition, setDefault = False) QWidget.resizeEvent(self, event) return