[Kde-perl] Couple of problems with Qt::TextEdit - one serious

Germain Garand kde-perl@mail.kde.org
Mon, 3 Mar 2003 20:47:32 +0000


Le Lundi 03 Mars 2003 15:47, Rich a =E9crit :
> Hi everyone

Hello,

>
> I've got one non-serious and one deadly problem with Qt::TextEdit.
>
> 1) Appending text to textedit widgets in "log viewer" mode in Qt3.1x ca=
uses
> a spurious new line to get added between each text chunk. I've looked a=
t
> the archive from a recent discussion:
>
>   http://lists.kde.org/?l=3Dkde-perl&m=3D104525628210582&w=3D2
>
> So, am I correct in assuming this is a PerlQt issue that is known about=
?

err... no I think not.
As said in the message you link to, It's the normal Qt behaviour.
QTextEdit::append() adds a new paragraph to the text ( for simple and=20
richtext, since v3.0.5.), hence the newline.
I'm not very familiar with QTextEdit, but it seems you need to set the wh=
ole=20
text at once each time you add a line to avoid the creation of a new=20
paragraph (at least that's what I did for pqtsh).

Their might be other solutions, I don't know.


>
> 2) I can blow Qt up with ease:
>
> ############################################################
>
> use strict;
>
> use Qt;
>
> my $app    =3D Qt::Application(\@ARGV);
> my $widget =3D Qt::TextEdit;
> my $string =3D "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n" x 100000=
;
>
> {
>   use bytes ();
>
>   print "Displayed text size: ", bytes::length($string), "\n";
> }
>
> $widget->resize(600,480);
> $widget->setText($string);
>
> $app->setMainWidget($widget);
>
> $widget->show;
>
> $app->exec;
>
> ############################################################
>
> If I run the above, right click and choose "Select all" the app crashes
> with the message "Broken pipe". I've tried this with perl 5.8, PerlQt
> 3.006, Qt3.0.5 and Qt3.1.1 with Mandrake and SuSE and the behaviour is =
the
> same.

I get the exact same result with  C++ source code on a Duron 800 MHz / 38=
4Mb,=20
so no, that's not related to PerlQt...=20

mmh wait... looking closer, it really looks like the culprit is KDE's kli=
pper=20
that doesn't like having to deal with a 4 Megs selection. Or the X clipbo=
ard,=20
maybe.

If I suppress it from kicker, everything is fine... then if I add it whil=
e the=20
text is selected, the mysterious pipe strike again...

Germain

>
> Ok, the string is a reasonable size but not huge, and my machines have =
512M
> memory. Can other folks on the list try the above code and see if they =
get
> the same behaviour?
>
> Can anyone suggest if this is a PerlQt or Qt issue?
>
> Many thanks,