Re: Converting Qt4 QString to ordinary Perl string

Chris Burel <[email protected]> Wed, 17 Jun 2009 05:46:27 +0900
Newsgroups gmane.comp.kde.devel.perl
Message-ID <[email protected]>
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 =3D 0;
my $perlStr =3D '';
while( $i < $string->count() ) {
    $perlStr .=3D 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<[email protected]> 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 =3D 'string';
>>my $obj =3D 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? =A0I think you must be running the non-smoke
> QtCore+QtGUI distros.
>
> =A0http://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. =A0The developer also does not seem to respond to any of my
> mail.
>
> On the other hand:
>
> =A0http://code.google.com/p/perlqt4/
>
> This intends to be a successor to the old PerlQt (3) and will work much
> like it. =A0Plus, 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.
> ---------------------------------------------------
> =A0 =A0http://scratchcomputing.com
> ---------------------------------------------------
> _______________________________________________
> Kde-perl mailing list
> [email protected]
> https://mail.kde.org/mailman/listinfo/kde-perl
>