[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] PyQt: Something wrong with QTextStream.read()
From:       Phil Thompson <phil () riverbankcomputing ! co ! uk>
Date:       2004-12-19 0:27:18
Message-ID: 200412190027.18120.phil () riverbankcomputing ! co ! uk
[Download RAW message or body]

On Sunday 19 December 2004 12:14 am, Troy Melhase wrote:
> On Saturday 18 December 2004 02:55 pm, Parzival Herzog wrote:
> > 1 from qt import *
> > 2 woof = "WOOF\n"
> > 3 print woof
> > 4 woof_ts = QTextStream(woof, IO_ReadOnly)
> > 5 print woof
> > 6 rewoof = woof_ts.read()
> > 7 print rewoof
>
> Can you make the string a QByteArray?  This works for me:
>
>
> from qt import *
> woof = QByteArray("WOOF\n")
> print woof
> woof_ts = QTextStream(woof, IO_ReadOnly)
> print woof
> rewoof = woof_ts.read()
> print rewoof

Yes - or a QString.

In the original code a temporary QString is being created under the covers (to 
hold the converted Python string) which is then being destroyed.

Phil

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic