[Kde-perl] Converting Qt4 QString to ordinary Perl string

Chris Burel chrisburel at gmail.com
Tue Jun 16 22:46:27 CEST 2009


As I recall from when I looked at that version of the binding from a
year ago, you have to go through a roundabout method to get the data
out of the QString object.

my $i = 0;
my $perlStr = '';
while( $i < $string->count() ) {
    $perlStr .= chr( $string->at($i)->cell() );
    $i++
}
print $perlStr;
Hi there

Very difficult.  This was one of the reasons the smoke-based PerlQt4
project was started.  The link has already been posted.

On Sun, Jun 14, 2009 at 10:51 AM, Eric
Wilhelm<ewilhelm at scratchcomputing.com> wrote:
> # from Adam Bar
> # on Friday 12 June 2009 15:37:
>
>>My question is maybe stupid, but I am looking for few hours for the
>>solution - how to get string value from variable blessed QString?
>>my $str = 'string';
>>my $obj = QString($str);
>># how to get 'string' from $obj ?
>>
>>Methods like latin1(), ascii() are not defined in my perl binding.
>>
>>I am using Perl Qt 4.004, Perl 5.8.8.
>
> Hi Adam,
>
> Where did you get this Qt.pm?  I think you must be running the non-smoke
> QtCore+QtGUI distros.
>
>  http://search.cpan.org/~vadiml/QtCore-4.004/
>
> I haven't looked at that much except to determine that the API was
> fabricated from generated XS code and seems to require that every
> string be constructed using a QString() function -- which is not very
> perlish.  The developer also does not seem to respond to any of my
> mail.
>
> On the other hand:
>
>  http://code.google.com/p/perlqt4/
>
> This intends to be a successor to the old PerlQt (3) and will work much
> like it.  Plus, the maintainers of this code *are* on this list.
> However, it isn't on the CPAN yet.
>
> --Eric
> --
> If the above message is encrypted and you have lost your pgp key, please
> send a self-addressed, stamped lead box to the address below.
> ---------------------------------------------------
>    http://scratchcomputing.com
> ---------------------------------------------------
> _______________________________________________
> Kde-perl mailing list
> Kde-perl at kde.org
> https://mail.kde.org/mailman/listinfo/kde-perl
>


More information about the Kde-perl mailing list