QtGui

 view release on metacpan or  search on metacpan

examples/mainwindows/menus/MainWindow.pm  view on Meta::CPAN

    $this->{infoLabel}->setText(QString('Invoked <b>Edit|Format|Set Line Spacing</b>'));
}

sub setParagraphSpacing {
    my $this = shift;
    $this->{infoLabel}->setText(QString('Invoked <b>Edit|Format|Set Paragraph Spacing</b>'));
}

sub about {
    my $this = shift;
    $this->{infoLabel}->setText(QString('Invoked <b>Help|About</b>'));
    QMessageBox::about($this, QString("About Menu"),
            QString('The <b>Menu</b> example shows how to create menu-bar menus and context menus.'));
}

sub aboutQt {
    my $this = shift;
    $this->{infoLabel}->setText(QString('Invoked <b>Help|About Qt</b>'));
}

sub createActions {
    my $this = shift;

    $this->{newAct} = QAction(QString("&New"), $this);
    $this->{newAct}->setShortcut(QKeySequence(QString("Ctrl+N")));
    $this->{newAct}->setStatusTip(QString("Create a new file"));
    $this->connect($this->{newAct}, SIGNAL('triggered()'), $this, SLOT('newFile()'));

    $this->{openAct} = QAction(QString("&Open..."), $this);
    $this->{openAct}->setShortcut(QKeySequence(QString("Ctrl+O")));
    $this->{openAct}->setStatusTip(QString("Open an existing file"));
    $this->connect($this->{openAct}, SIGNAL('triggered()'), $this, SLOT('open_()'));

    $this->{saveAct} = QAction(QString("&Save"), $this);
    $this->{saveAct}->setShortcut(QKeySequence(QString("Ctrl+S")));
    $this->{saveAct}->setStatusTip(QString("Save the document to disk"));
    $this->connect($this->{saveAct}, SIGNAL('triggered()'), $this, SLOT('save()'));

    $this->{printAct} = QAction(QString("&Print..."), $this);
    $this->{printAct}->setShortcut(QKeySequence(QString("Ctrl+P")));
    $this->{printAct}->setStatusTip(QString("Print the document"));
    $this->connect($this->{printAct}, SIGNAL('triggered()'), $this, SLOT('print_()'));

    $this->{exitAct} = QAction(QString("E&xit"), $this);
    $this->{exitAct}->setShortcut(QKeySequence(QString("Ctrl+Q")));
    $this->{exitAct}->setStatusTip(QString("Exit the application"));
    $this->connect($this->{exitAct}, SIGNAL('triggered()'), $this, SLOT('close()'));

    $this->{undoAct} = QAction(QString("&Undo"), $this);
    $this->{undoAct}->setShortcut(QKeySequence(QString("Ctrl+Z")));
    $this->{undoAct}->setStatusTip(QString("Undo the last operation"));
    $this->connect($this->{undoAct}, SIGNAL('triggered()'), $this, SLOT('undo()'));

    $this->{redoAct} = QAction(QString("&Redo"), $this);
    $this->{redoAct}->setShortcut(QKeySequence(QString("Ctrl+Y")));
    $this->{redoAct}->setStatusTip(QString("Redo the last operation"));
    $this->connect($this->{redoAct}, SIGNAL('triggered()'), $this, SLOT('redo()'));

    $this->{cutAct} = QAction(QString("Cu&t"), $this);
    $this->{cutAct}->setShortcut(QKeySequence(QString("Ctrl+X")));
    $this->{cutAct}->setStatusTip(QString("Cut the current selection's contents to the clipboard"));
    $this->connect($this->{cutAct}, SIGNAL('triggered()'), $this, SLOT('cut()'));

    $this->{copyAct} = QAction(QString("&Copy"), $this);
    $this->{copyAct}->setShortcut(QKeySequence(QString("Ctrl+C")));
    $this->{copyAct}->setStatusTip(QString("Copy the current selection's contents to the clipboard"));
    $this->connect($this->{copyAct}, SIGNAL('triggered()'), $this, SLOT('copy()'));

    $this->{pasteAct} = QAction(QString("&Paste"), $this);
    $this->{pasteAct}->setShortcut(QKeySequence(QString("Ctrl+V")));
    $this->{pasteAct}->setStatusTip(QString("Paste the clipboard's contents into the current selection"));
    $this->connect($this->{pasteAct}, SIGNAL('triggered()'), $this, SLOT('paste()'));

    $this->{boldAct} = QAction(QString("&Bold"), $this);
    $this->{boldAct}->setCheckable(1); # 1 == true
    $this->{boldAct}->setShortcut(QKeySequence(QString("Ctrl+B")));
    $this->{boldAct}->setStatusTip(QString("Make the text bold"));
    $this->connect($this->{boldAct}, SIGNAL('triggered()'), $this, SLOT('bold()'));

    $this->{boldFont} = $this->{boldAct}->font();
    $this->{boldFont}->setBold(1); # 1 == true
    $this->{boldAct}->setFont($this->{boldFont});

    $this->{italicAct} = QAction(QString("&Italic"), $this);
    $this->{italicAct}->setCheckable(1); # true
    $this->{italicAct}->setShortcut(QKeySequence(QString("Ctrl+I")));
    $this->{italicAct}->setStatusTip(QString("Make the text italic"));
    $this->connect($this->{italicAct}, SIGNAL('triggered()'), $this, SLOT('italic()'));

    $this->{italicFont} = $this->{italicAct}->font();
    $this->{italicFont}->setItalic(1); # true
    $this->{italicAct}->setFont($this->{italicFont});

    $this->{setLineSpacingAct} = QAction(QString("Set &Line Spacing..."), $this);
    $this->{setLineSpacingAct}->setStatusTip(QString("Change the gap between the lines of a paragraph"));
    $this->connect($this->{setLineSpacingAct}, SIGNAL('triggered()'), $this, SLOT('setLineSpacing()'));

    $this->{setParagraphSpacingAct} = QAction(QString("Set &Paragraph Spacing..."), $this);
    $this->{setLineSpacingAct}->setStatusTip(QString("Change the gap between paragraphs"));
    $this->connect($this->{setParagraphSpacingAct}, SIGNAL('triggered()'), $this, SLOT('setParagraphSpacing()'));

    $this->{aboutAct} = QAction(QString("&About"), $this);
    $this->{aboutAct}->setStatusTip(QString("Show the application's About box"));
    $this->connect($this->{aboutAct}, SIGNAL('triggered()'), $this, SLOT('about()'));

    $this->{aboutQtAct} = QAction(QString("About &Qt"), $this);
    $this->{aboutQtAct}->setStatusTip(QString("Show the Qt library's About box"));
    $this->connect($this->{aboutQtAct}, SIGNAL('triggered()'), $qApp, SLOT('aboutQt()'));
    $this->connect($this->{aboutQtAct}, SIGNAL('triggered()'), $this, SLOT('aboutQt()'));

    $this->{leftAlignAct} = QAction(QString("&Left Align"), $this);
    $this->{leftAlignAct}->setCheckable(1); # true
    $this->{leftAlignAct}->setShortcut(QKeySequence(QString("Ctrl+L")));
    $this->{leftAlignAct}->setStatusTip(QString("Left align the selected text"));
    $this->connect($this->{leftAlignAct}, SIGNAL('triggered()'), $this, SLOT('leftAlign()'));

    $this->{rightAlignAct} = QAction(QString("&Right Align"), $this);
    $this->{rightAlignAct}->setCheckable(1); # true
    $this->{rightAlignAct}->setShortcut(QKeySequence(QString("Ctrl+R")));
    $this->{rightAlignAct}->setStatusTip(QString("Right align the selected text"));
    $this->connect($this->{rightAlignAct}, SIGNAL('triggered()'), $this, SLOT('rightAlign()'));

    $this->{justifyAct} = QAction(QString("&Justify"), $this);
    $this->{justifyAct}->setCheckable(1); # true
    $this->{justifyAct}->setShortcut(QKeySequence(QString("Ctrl+J")));
    $this->{justifyAct}->setStatusTip(QString("Justify the selected text"));
    $this->connect($this->{justifyAct}, SIGNAL('triggered()'), $this, SLOT('justify()'));

    $this->{centerAct} = QAction(QString("&Center"), $this);
    $this->{centerAct}->setCheckable(1); # true
    $this->{centerAct}->setShortcut(QKeySequence(QString("Ctrl+E")));



( run in 1.733 second using v1.01-cache-2.11-cpan-2398b32b56e )