[PyKDE] [PyQt] Problem with generated pyuic code: QSizePolicy()

Don donald.welch at hp.com
Tue Mar 1 22:56:44 GMT 2005


The following line of code (generated by pyuic under Eric 3.5.0) causes 
my program to fail (silently, no traceback or segfault, etc):

self.IconList.setSizePolicy(QSizePolicy(5,5,0,0,self.DeviceList.sizePolicy().hasHeightForWidth()))

What I don't understand is what is being passed into QSizePolicy. From 
the docs, the 2 allowable initializers are:

QSizePolicy::QSizePolicy ( SizeType hor, SizeType ver, bool hfw=FALSE )
QSizePolicy::QSizePolicy ( SizeType hor, SizeType ver, uchar horStretch, 
uchar verStretch, bool hfw = FALSE )

Where SizeType is one of:
QSizePolicy::Fixed
QSizePolicy::Minimum
QSizePolicy::Max
QSizePolicy::Preferred
etc.

 From this, I understand that hor=5, ver=5, horStretch=0, verStretch=0.

So one question is, why are these being passed in as integers rather 
than using the SizeType values?

This IconView is setup with a "Preferred" size policy, so I change the 
code to:

self.IconList.setSizePolicy(QSizePolicy(QSizePolicy.Preferred,QSizePolicy.Preferred,0,0,self.DeviceList.sizePolicy().hasHeightForWidth()))

With this change, the code works again as expected.

This is only occuring on a Mandrake Cooker system, with PyQt 3.14, Qt 
3.3.4 and SIP 4.2.

On a Gentoo box with PyQt 3.13, SIP 4.1.1, and Qt 3.3.3, this code works OK.

Thanks,

Don





More information about the PyQt mailing list