chrisburel / perlqt4

Automatically exported from code.google.com/p/perlqt4
Other
0 stars 0 forks source link

QByteArray.data() does not return all data #28

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
This is my case, it propably can be simplifed:
1. Get an instance of connected QTcpSocket, name it $socket
2. $buff = $socket->readAll()
3. $str = $buff->data()

What is the expected output? What do you see instead?
I expect that $str will contain all data contained in $buff object and
length $str == $buff->size(). This is how it happens for example in PyQT4

Unfortunately perqt internally treats QT data() return value as null terminated 
string, 
so any bytes after zero are lost. This implies, that QByteArray is partially 
unusable in PerlQt - I didn't find any reliable and fast method of getting data 
from QByteArray to Perl. 

What version of PerlQt4 are you using? What version of Qt are you using? On
what operating system?
latest, 4.5.2, Ubuntu 9.10

Please provide any additional information below.

If it is impossible to fix data() call that way, What is the good method of 
getting data from QByteArray to Perl string? 

Original issue reported on code.google.com by slawomir...@gmail.com on 8 Jun 2010 at 5:00

GoogleCodeExporter commented 9 years ago
Warking walkaround patch in attachment.

Original comment by slawomir...@gmail.com on 8 Jun 2010 at 9:17

Attachments:

GoogleCodeExporter commented 9 years ago
Working*

Original comment by slawomir...@gmail.com on 8 Jun 2010 at 9:18

GoogleCodeExporter commented 9 years ago

Original comment by chrisbu...@gmail.com on 20 Jun 2010 at 1:05

GoogleCodeExporter commented 9 years ago
I've applied this patch, or a slightly modified one, to svn.  However, since 
the code is now maintained in the KDE repository, the svn from Google Code was 
pretty out of date, and there are some pretty significant changes.  Update your 
svn checkout and recompile, and change all "Qt4::" to "Qt::" in your code, and 
let me know if it works for you now.

Original comment by chrisbu...@gmail.com on 21 Jun 2010 at 5:53