[PyQt] PyQwt and SIP-4.12.1

Gerard Vermeulen gav451 at gmail.com
Fri Jan 28 14:30:18 GMT 2011


On 01/28/2011 12:22 PM, Phil Thompson wrote:
> On Thu, 27 Jan 2011 16:28:48 +0100, Gerard Vermeulen <gav451 at gmail.com>
> wrote:
>> Hi,
>>
>> The following works with sip-4.12 (python compiled in my home
> directory):
>> Python 2.6.6 (r266:84292, Jan  8 2011, 16:35:06)
>> [GCC 4.4.4] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> import PyQt4.Qwt5 as qwt
>>>>> import sip
>>>>> sip.SIP_VERSION_STR
>> '4.12'
>>>>> qwt.QwtText(Qt.QString("wow"))
>> <PyQt4.Qwt5.Qwt.QwtText object at 0x216cb90>
>> but not with sip-4.12.1 (python in Gentoo system):
>> Python 2.6.6 (r266:84292, Dec 30 2010, 09:16:49)
>> [GCC 4.4.4] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> import PyQt4.Qwt5 as qwt
>>>>> import sip
>>>>> sip.SIP_VERSION_STR
>> '4.12.1'
>>>>> qwt.QwtText(Qt.QString("wow"))
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>> TypeError: QwtText(): arguments did not match any overloaded call:
>>   overload 1: argument 1 has unexpected type 'QString'
>>   overload 2: argument 1 has unexpected type 'QString'
>>
>> The relevant part of the sip file for QwtText is attached.
>>
>> Best regards -- Gerard
> Can you provide I self contained test case that demonstrates the problem
> (I can't)?
>
> Phil
OK, I think this is the same problem that I found when trying to use hgview
(shows up when using qscintilla):

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import PyQt4.Qt as Qt
from PyQt4.Qsci import QsciScintilla

application = Qt.QApplication([])
qs = QsciScintilla()
qs.setMarginWidth(1, '000')

# Local Variables: ***
# mode: python ***
# End: ***

gives:

gav at zombie ~ $ python 041201.py
Traceback (most recent call last):
  File "041201.py", line 9, in <module>
    qs.setMarginWidth(1, '000')
TypeError: arguments did not match any overloaded call:
  QsciScintilla.setMarginWidth(int, int): argument 2 has unexpected type 'str'
  QsciScintilla.setMarginWidth(int, QString): argument 2 has unexpected type 'str'

And if you replace
qs.setMarginWidth(1, '000')
with
qs.setMarginWidth(1, Qt.QString('000'))
you'll get

gav at zombie ~ $ python 041201.py
Traceback (most recent call last):
  File "041201.py", line 9, in <module>
    qs.setMarginWidth(1, Qt.QString('000'))
TypeError: arguments did not match any overloaded call:
  QsciScintilla.setMarginWidth(int, int): argument 2 has unexpected type 'QString'
  QsciScintilla.setMarginWidth(int, QString): argument 2 has unexpected type
'QString'

Gerard


More information about the PyQt mailing list