Commits

Shlomi Fish committed 844fb7c

Add the menu bar to the main window.

  • Participants
  • Parent commits b35efff

Comments (0)

Files changed (1)

App-Qt-AdHocFileManager/lib/App/Qt/AdHocFileManager/Window.pm

 use QtCore4;
 use QtGui4;
 
-use QtCore4::isa qw( Qt::Widget );
-use QtCore4::slots update => [];
+use QtCore4::isa qw( Qt::MainWindow );
+use QtCore4::slots update => [], windowExit => [];
 
 sub addendLineEdit() {
     return this->{addendLineEdit};
 }
 
 
+sub windowExit() {
+    exit(0);
+}
+
 sub NEW {
     my ( $class, $parent ) = @_;
     $class->SUPER::NEW( $parent );
 
     $layout->addWidget($files_tree, 2, 0, 1, 3);
 
-    this->setLayout($layout);
+    my $widget = Qt::Widget();
+    $widget->setLayout($layout);
+    this->setCentralWidget($widget);
 
     this->connect($update_button, SIGNAL 'clicked()',
         this, SLOT 'update()');
 
     this->setWindowTitle(this->tr(q{Shlomif's Ad-Hoc File Manager}));
 
+    my $fileMenu = this->menuBar()->addMenu(this->tr("&File"));
+    my $exitAction = Qt::Action(this->tr("E&xit"), this);
+
+    this->connect($exitAction, SIGNAL 'triggered()',
+        this, SLOT 'windowExit()');
+
+    $fileMenu->addAction($exitAction);
+
     this->update();
 }