[PyKDE] PyQt for Python 2.4?

Gerard Vermeulen gerard.vermeulen at grenoble.cnrs.fr
Tue Dec 14 07:38:35 GMT 2004


On Tue, 14 Dec 2004 00:55:41 -0600
Mike Meyer <mwm at mired.org> wrote:

> [Format recovered from topposting.]
> 
> In <200412131907.26002.eronlloyd at verizon.net>, Eron Lloyd <eronlloyd at verizon.net> typed:
> 
> > On Monday 13 December 2004 7:02 pm, Mike Meyer wrote:
> > > I tried building PyQt with Python 2.4, and ran into a compile time
> > > problem that exceeded my (very limited) knowledge of C++.
> > >
> > > Are there any estimates on when we'll see a version of PyQt that will
> > > build with Python 2.4?
> >
> > What was your error? I just got it working myself.
> 
> Here's the error:
> 
> c++ -c -pipe -fPIC -O -pipe -mpreferred-stack-boundary=2 -march=athlon -Wall -W -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -I. -I/usr/opt/include -I/usr/opt/include/python2.4 -I/usr/X11R6/include -o sipqtQString.o sipqtQString.cpp
> sip/qt/qstring.sip: In function `int convertTo_QString(PyObject*, void**, int*)':
> sip/qt/qstring.sip:854: error: conversion from `long unsigned int' to `const QChar' is ambiguous
> /usr/X11R6/include/qstring.h:295: note: candidates are: QChar::QChar(int)
> /usr/X11R6/include/qstring.h:289: note:                 QChar::QChar(uint)
> /usr/X11R6/include/qstring.h:283: note:                 QChar::QChar(short int)
> /usr/X11R6/include/qstring.h:277: note:                 QChar::QChar(ushort)
> /usr/X11R6/include/qstring.h:258: note:                 QChar::QChar(uchar)
> /usr/X11R6/include/qstring.h:252: note:                 QChar::QChar(char)
> 
> The code is trying to turn a Python unicode string into a QString with
> for loop, doing
> 	qstring[i] = py_unicode_string[i] ;
> 
> This is with qt 3.3.3, sip 4.1.1, and py-qt 3.13.
> 
> 	<mike
> 
Presumably you have UCS4 unicode encoding.  I guess that in ???/include/python/pyconfig.h you
have a line:
#define PY_UNICODE_TYPE long unsigned int
(the 'int' may be missing).

If so, you can work around your problem with casts. Change the line to:
        qstring[i] = QChar(uint(py_unicode_string[i]));

Gerard






More information about the PyQt mailing list