[Kde-perl] PerlQT Canvas Sample?
Gerhard Stenzel
gerhard.stenzel at vr-web.de
Sat Mar 13 11:52:37 CET 2004
>Small? How about a one-liner?
Thanks Ashley. Exactly what I was looking for. For the convenience
of other beginnners, I added some newlines to make it easier to read:
#!/usr/bin/perl
use Qt;
$a=Qt::Application(\@ARGV);
$c = Qt::Canvas 1000,1000;
$t = Qt::CanvasText "Howdy", $c;
show $t;
$cv = Qt::CanvasView $c;
setMainWidget $a $cv;
show $cv;
$a->exec
This works, also for me. Now if I try to do the same thing in
pqt-designer, it does not work ... I see a mainwindow, a canvasview with scrollbars, but no text.
Obviously, I am making a rather trivial mistake, but fail to spot it.
I include the init() from pqt-designer:
sub init
{
my $c = Qt::Canvas(1000,1000);
my $t = Qt::CanvasText("Howdy", $c);
$t->show();
my $cv = Qt::CanvasView($c, this);
$cv->setGeometry( Qt::Rect(10, 10, 200,200) );
$cv->show();
}
Any ideas?
Gerhard
More information about the Kde-perl
mailing list