[PyQt] Force the ratio of a widget
frederic.mantegazza at gbiloba.org
Wed Jan 14 16:10:30 GMT 2009
Le 14/1/2009, "Doug Bell" <dougb at bellz.org> a écrit:
>Try overriding QLayoutItem.hasHeightForWidth() and
>QLayoutItem.heightForWidth(w) in a custom layout.
It does not seems to work :o( The layout does not remains sqaure...
Here is part the code involved:
def heightForWidth(self, width):
mainWindow = uic.loadUi("mainWindow.ui")
mainWindow.myGridLayout.heightForWidth = \
mainWindow.myGridLayout.hasHeightForWidth = \
Could it come from the fact I'm using the uic module to load my GUI? Or
because I dynamically rebind the methods (from a python point of view,
it works, as I checked that my methods are called)?
BTW, is it possible to do the opposite, setting the width from the
height? I didn't find any methods, which is strange from Qt...
More information about the PyQt