PerlKDE
view release on metacpan or search on metacpan
t/kcharsetstest view on Meta::CPAN
#!/usr/bin/perl -w
use KDE;
import KDE::app;
package Test;
import KDE::app;
use Qt::slots 'convert()', 'changeDisplayCharset()';
@ISA = qw(Qt::Widget);
sub new {
my $self = shift->SUPER::new(@_);
$self->setCaption("Testing KCharsets");
my $d = $app->desktop;
$self->setGeometry(($d->width-320) >> 1, ($d->height-160) >> 1, 320, 160);
$self->createFields;
$self->show;
return $self
}
sub createFields {
my $self = shift;
my $charsets = $app->getCharsets;
my $displayable = $charsets->displayable;
my $available = $charsets->available;
my($y, $dy, $h) = (10, 30, 25);
my($label_x, $rest_x, $label_w, $rest_w) = (10, 105, 100, 200);
my $inputCharsetLabel = $self->{inputCharsetLabel} =
new Qt::Label("inputCharset", $self);
$inputCharsetLabel->setGeometry($label_x, $y, $label_w, $h);
my $inputCharsetCombo = $self->{inputCharsetCombo} =
new Qt::ComboBox($self);
for my $ch (@$available) {
$inputCharsetCombo->insertItem($ch);
}
$inputCharsetCombo->setGeometry($rest_x, $y, $rest_w, $h);
$self->connect($inputCharsetCombo, 'activated(int)', 'convert()');
$y += $dy;
my $inputLabel = $self->{inputLabel} =
new Qt::Label("input", $self);
$inputLabel->setGeometry($label_x, $y, $label_w, $h);
my $inputEdit = $self->{inputEdit} =
new Qt::LineEdit($self);
$inputEdit->setGeometry($rest_x, $y, $rest_w, $h);
$self->connect($inputEdit, 'returnPressed()', 'convert()');
$y += $dy;
my $outputCharsetLabel = $self->{outputCharsetLabel} =
new Qt::Label("outputCharset", $self);
$outputCharsetLabel->setGeometry($label_x, $y, $label_w, $h);
my $outputCharsetCombo = $self->{outputCharsetCombo} =
new Qt::ComboBox($self);
$self->connect($outputCharsetCombo, 'activated(int)', 'convert()');
for my $ch (@$available) {
$outputCharsetCombo->insertItem($ch);
}
$outputCharsetCombo->setGeometry($rest_x, $y, $rest_w, $h);
$y += $dy;
my $displayCharsetLabel = $self->{displayCharsetLabel} =
new Qt::Label("displayCharset", $self);
$displayCharsetLabel->setGeometry($label_x, $y, $label_w, $h);
my $displayCharsetCombo = $self->{displayCharsetCombo} =
new Qt::ComboBox($self);
$self->connect($displayCharsetCombo,
'activated(int)', 'changeDisplayCharset()');
for my $ch (@$displayable) {
$displayCharsetCombo->insertItem($ch);
}
$displayCharsetCombo->setGeometry($rest_x, $y, $rest_w, $h);
$y += $dy;
my $outputLabel = $self->{outputLabel} =
( run in 1.991 second using v1.01-cache-2.11-cpan-a49fcb8fa48 )