#!/usr/bin/perl

use strict;

package MyDialog;
use Qt;
use Qt::isa qw(Qt::Widget);
use Qt::slots
	OnButtonClick => [];

sub NEW
{
	my $self = shift;
	$self->SUPER::NEW(@_);

	this->setCaption("Display the stem");
	#setting the layout&title
	this->{vertical}=Qt::VBoxLayout(this,5,7,"vertical");
	this->{title}=Qt::Label("Find the stem of an Arabic word",this,"title");
	this->{vertical}->addWidget(this->{title});
	this->{box}=Qt::GridLayout(undef,2,2,5,7,"box");
	this->{vertical}->addLayout(this->{box});
	
	#setting the input text edit
	this->{lb_input}=Qt::Label ("Input word:",this,"label");
	this->{box}->addWidget(this->{lb_input},1,1);
	this->{te_input}=Qt::TextEdit("",undef,this,"input word");
	this->{box}->addWidget(this->{te_input},1,2);
	
	#setting the Stem button
	this->{pb_stem}=Qt::PushButton("&Stem", this,"stem button");
	this->{box}->addWidget(this->{pb_stem},1,3);
	
	#setting the output text edit
	this->{lb_stem}=Qt::Label ("Stem:",this,"label2");
	this->{box}->addWidget(this->{lb_stem},2,1);
	this->{te_output}=Qt::TextEdit("",undef,this,"output stem");
	this->{te_output}->setReadOnly(1);
	this->{box}->addWidget(this->{te_output},2,2);

	this->connect(this->{pb_stem}, SIGNAL('clicked()'), SLOT('OnButtonClick()'));
	
	#setting the Quit button
	this->{pb_quit}=Qt::PushButton("&Quit", this);
	this->{vertical}->addWidget(this->{pb_quit},1,3);	
}

sub OnButtonClick
{	
	this->{pb_stem}->setText("Dude");
}

1;

package Main;
my $app = Qt::Application(\@ARGV);
my $wid = new MyDialog;
$app->setMainWidget($wid);
$wid->show;
exit $app->exec;
