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

List:       kde-perl
Subject:    Re: [Kde-perl] PerlQt-3.006
From:       Stéphane Payrard <stef () payrard ! net>
Date:       2003-02-14 20:56:41
[Download RAW message or body]

On Fri, Feb 14, 2003 at 06:47:16PM +0000, Germain Garand wrote:
> Le Vendredi 14 Février 2003 13:11, Stéphane Payrard a écrit :
> > Hi Germain.
> >
> > Great release.
> > I like very much pqtsh and pqtapi.
> 
> Thanks :)

I will probably write something on top of pqtapi and post it
in PerlMonks to get some visibility to PerlQt.

> 
> >
> > Attached is a diff for pqtsh.  With that diff applied, outputs to
> > SDTOUT and STDERR are redirected to the sessionLog widget with the
> > later printed in red.
> >
> 
> Good one!
> I didn't thought about the possibility of using pqtsh as a full shell (and not 
> just as a PerlQt exploration tool). That's a far more exciting approach.
> 
> Now I need to sort out the mess Trolltech made with RichText and line 
> breaks...
> I noticed you removed the double BRs... in fact, it doesn't work with Qt<3.0.5 
> due to a pesky bug, it just refuses to go to next line.
> Qt-3.0.5 ChangeLog excerpt:
> 
> |QTextEdit
> |
> | Fixed append() for the richtext case (it didn't add a new paragraph for each
> | append). Made the output format of the editor in rich text mode lossless.
> | Fixed support for line breaks, they now start a new line in the same
> | paragraph rather than a new paragraph.
> 
> And worse, in Qt 3.1, I see a double line break for each append, even if I 
> don't add BRs.
> Anyone else see that ?
> It probably means the new append() behaviour is to systematically skip a 
> line... mmmh, bad bad bad.

Yes, I forgot to remove my attempt of fixing the behavior. Sorry about
that. Speaking of TextEdit, The only thing I find missing in Qt is an
equivalent of the Tk::Text widget.

> 
> >
> >
> > I find a drag to be obliged to explicitely derive classes for minimally
> > customized widgets.  Would it be possible to implicitely define a
> > class per instance when using the following syntax to add signals, slots
> > and attributes for that instance?
> >
> > this->signal(    changeIt   => ['int', 'int'] );
> > this->slots(     wasCLicked => [ [], sub { }] );
> > this->attributes qw( more attributes );
> >
> > I have not sufficient understanding of the internals to know if it is
> > possible. Also I am not sure what 'ref' should return when applied to
> > such an object.
> 
> That would be possible, but I really doubt it could be a good thing...
> It's clearly a big breach in object orientation (giving an anonymous sub{} as 
> argument to a new slot, that's just returning to the painful mess of 
> callbacks)
> 
> After all, adding sig/slots to a widget is just a matter of 4 lines:
> 
> package myButton;
> use Qt::isa qw(Qt::PushButton);
> use Qt::slots foo=>[];
> sub foo { #do something }
> 
> (You don't need to reimplement NEW if you've got nothing more to say).
> 
> Now I understand the appeal of quick procedural shortcuts, but it's so easy to 
> abuse... It's not really possible to add them and just say "use with 
> tremendous care, that's evil!" expecting that people will behave themselves
> (think "goto" and the years of education that were necessary to step back :)
> 
> As for adding new signals/slots/attributes to subclassed widgets at runtime, I 
> added
>    eval "use Qt::slots foo=>[]" 
> and the like...
> I"m very reluctant to go any further and make it part of the API...

I understand that the current API is very direct and clean translation
of the C++ documentation. Probably adding perlish hacks on top of that
will be a loss.  I just wanted to know if it was possible to have a
motivation to unserstand the internals.


I notice some insconsistency probably in thw way of creating widgets
(probablt because  I am using an unsupported idiom, not ever an optimal one).
Standard Qt widget can be created using $a->constructor while mine
can't. See  file attached

$a = Qt::Application;
...
my $mw = $a->MainWindow();
...
$a->LineEdit($vb);     # works
$a->MyLineEdit($vb);   # does not work



Finally, could the 'use Qt::isa ...' pull the Qt stuff if 'use Qt' has
not already done it.


--
 stef

> 
> Germain


#! /usr/bin/perl

package MyLineEdit;
use Qt; # <== could this one be optional
use Qt::isa 'Qt::LineEdit';

1;



package main;
use Qt;
use MyLineEdit;

my $a  = Qt::Application();
my $mw = $a->MainWindow();
my $vb = $a->VBox($mw);
$mw->setCentralWidget($vb);
$a->LineEdit($vb);    # accepted
# $a->MyLineEdit($vb);  # refused
$mw->show;
$a->exec;

_______________________________________________
Kde-perl mailing list
Kde-perl@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-perl

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

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