Commits

Shlomi Fish  committed a02e9b1

Implement the add functionality.

  • Participants
  • Parent commits 1e46bc8

Comments (0)

Files changed (1)

File minicalc/Window.pm

 use QtGui4;
 # [0]
 use QtCore4::isa qw( Qt::Widget );
-use QtCore4::slots;
+use QtCore4::slots update => [];
 
 sub addendLineEdit() {
     return this->{addendLineEdit};
     return this->{resultLineEdit} = shift;
 }
 
+sub update {
+    this->resultLineEdit->setText(
+        this->addendLineEdit()->text() + this->addend2LineEdit->text()
+    );
+}
+
 # [0]
 
 # [0]
     $layout->addWidget($addend2Group, 0, 1);
     $layout->addWidget($resultGroup, 0, 2);
 
-    my $button = Qt::PushButton("Update");
-    $layout->addWidget($button, 1, 0, 1, 2);
+    my $update_button = Qt::PushButton("Update");
+    $layout->addWidget($update_button, 1, 0, 1, 2);
     this->setLayout($layout);
 
+    this->connect($update_button, SIGNAL 'clicked()',
+        this, SLOT 'update()');
+
     this->setWindowTitle(this->tr('Line Edits'));
 }