#!/usr/bin/perl -w

use Qt 2.0 qw($app %Align %Color %Direction %Frame);

$f = QGroupBox->new;
$f->setFrameStyle($Frame{Panel} | $Frame{Sunken});

$gm = QGridLayout->new($f, 3, 3, 5);

$gm->setColStretch(0, 1);
$gm->setColStretch(1, 3);
$gm->setColStretch(2, 0);

$gm->setRowStretch(0, 2);
$gm->setRowStretch(1, 6);
$gm->setRowStretch(2, 1);

$box = QBoxLayout->new($Direction{TopToBottom}, 2);
$gm->addLayout($box, 0, 0);

$above = QBoxLayout->new($Direction{LeftToRight});
$box->addLayout($above, 7);
for my $i (0..3) {
    my $lab = QLabel->new($f);
    $lab->setBackgroundColor($Color{DarkGreen});
    $above->addWidget($lab);
}
$below = QBoxLayout->new($Direction{LeftToRight});
$box->addLayout($below, 4);
for my $i (0..2) {
    my $lab = QLabel->new($f);
    $lab->setBackgroundColor($Color{DarkBlue});
    $below->addWidget($lab);
}

$qb = QPushButton->new('Quit', $f);
$app->connect($qb, 'clicked()', 'quit()');
$qb->setFixedSize($qb->size());
$gm->addWidget($qb, 0, 2, $Align{Center});

$ed = QMultiLineEdit->new($f);
$ed->setText("This is supposed to be a large window\n you know.");
$ed->setMinimumSize(150, 150);
$gm->addMultiCellWidget($ed, 1, 1, 1, 2);

$l1 = QLabel->new($f);
$l1->setText('This is label 1.');
$l1->setBackgroundColor($Color{Yellow});
$l1->setMinimumSize($l1->sizeHint());
$gm->addWidget($l1, 0, 1);

$l2 = QLabel->new($f);
$l2->setText("This\nis\nlabel\ntoo.");
$l2->setBackgroundColor($Color{Red});
$l2->setMinimumSize($l2->sizeHint());
$gm->addWidget($l2, 1, 0);

$l3 = QLabel->new($f);
$l3->setText('This is label III.');
$l3->setBackgroundColor($Color{Red});
$l3->setMinimumSize($l3->sizeHint());
$gm->addWidget($l3, 2, 2);

$l4 = QLabel->new($f);
$l4->setText('More Label.');
$l4->setBackgroundColor($Color{Cyan});
$l4->setMinimumSize($l4->sizeHint());
$gm->addMultiCellWidget($l4, 2, 2, 0, 1);

$gm->activate();
$f->show();

$app->setMainWidget($f);
$app->exec();
