[PyKDE] Re: [PyQt] Problem with generated pyuic code: QSizePolicy()
Don
donald.welch at hp.com
Tue Mar 1 23:24:51 GMT 2005
OK, I went back and read all the posts on this issue that I neglected to
read before I posted this.
One question remains: What version of PyQt (or, is it part of Eric?) has
the version of pyuic that will generate code that works with SIP 4.2
(that is, it generates enums rather than integers for the QSizePolicy
arguments)?
I don't have the luxury of specifying what version of SIP is installed
on a system for my code to work. I certainly cannot count on a "hacked"
version that turns off the enum checking. Therefore, I assume that
passing the enums is the safest way to assure that it works "across the
board"?
Thanks,
Don
Don wrote:
>
> 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