[PyQt] Work-around for “.cascadeSubWindows” oversize
Pietro Moras
studio-pm at hotmail.com
Wed May 25 16:22:50 BST 2011
Thanks to David's hint (see), I've detected the cause of the “.cascadeSubWindows” oversizing of child sub-windows, and developed a work-around as here follows.
Problem had probably to do with MDI window size taken by PyQt4 in place of the Central Widget “mdiArea”.
See you, next time.
- P.M.
def _onCascade(self): #<-
"on Cascade command" #standard "Documentation String"
#-- - - -=- - - - -=- - - - -=- - - - -=- - - - -=- - - - -=- - - - -=- - - - -=
# Prologue
def cascadeFit(self): #<-"Fit" function definition
#--Register
rgL=[] #List
rgN=0 #Integer
rgGp=None #General purpose
#--Action
rgL=self.mdiArea.subWindowList() #--get child-List,
rgN=len(rgL) # and child-count
if (rgN<1): return(rgN) #no sub-window: exit
rgW = self.mdiArea.width() #--get actually available room
rgH = self.mdiArea.height()
#--compute cascade offset dimensions
if (rgN<2): #<-less than 2 sub-windows: no offset
rgCx=0
rgCy=0
elif (rgN>1): #<-more than 1 sub-window: get offset
rgCx=rgL[1].x()
rgCy=rgL[1].y()
#>
rgCx=rgCx*(rgN-1) #compute total cascade offset
rgCy=rgCy*(rgN-1)
#<-loop resize all sub-windows, so to fit them into available room
for rgGp in rgL:
rgGp.resize(rgW-rgCx, rgH-rgCy)
#>
return(rgN)
#cascadeFit>
#-- - - -=- - - - -=- - - - -=- - - - -=- - - - -=- - - - -=- - - - -=- - - - -=
# Action
#--call "cascade" method, as-is (rudimentary)
self.mdiArea.cascadeSubWindows()
rgN=cascadeFit(self) #"fit" all sub-windows into available room
return
#_onCascade>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110525/290d52bd/attachment.html>
More information about the PyQt
mailing list