summaryrefslogtreecommitdiffstats
path: root/PerlQt/tutorials/t7/t7.pl
blob: c798e28fddb7a9ae0280e0e0af7bf56543791b3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/perl -w
use strict;
use blib;

package MyWidget;
use Qt;
use Qt::isa qw(Qt::VBox);

use LCDRange;

sub NEW {
    shift->SUPER::NEW(@_);

    my $quit = Qt::PushButton("Quit", this, "quit");
    $quit->setFont(Qt::Font("Times", 18, &Qt::Font::Bold));

    Qt::app->connect($quit, SIGNAL('clicked()'), SLOT('quit()'));

    my $grid = Qt::Grid(4, this);

    my $previous;
    for my $r (0..3) {
	for my $c (0..3) {
	    my $lr = LCDRange($grid);
	    $previous->connect(
		$lr, SIGNAL('valueChanged(int)'),
		SLOT('setValue(int)')) if $previous;
	    $previous = $lr;
	}
    }
}

package main;
use MyWidget;

my $a = Qt::Application(\@ARGV);
my $w = MyWidget;
$a->setMainWidget($w);
$w->show;
exit $a->exec;