Qt
view release on metacpan or search on metacpan
qtgui/examples/mainwindows/menus/MainWindow.pm view on Meta::CPAN
this->getInfoLabel->setText(this->tr('Invoked <b>Edit|Format|Set Paragraph Spacing</b>'));
}
sub about()
{
this->getInfoLabel->setText(this->tr('Invoked <b>Help|About</b>'));
Qt::MessageBox::about(this, this->tr('About Menu'),
this->tr('The <b>Menu</b> example shows how to create ' .
'menu-bar menus and context menus.'));
}
sub aboutQt()
{
this->getInfoLabel->setText(this->tr('Invoked <b>Help|About Qt</b>'));
}
# [4]
sub createActions()
{
# [5]
my $newAct = this->{newAct} = Qt::Action(this->tr('&New'), this);
$newAct->setShortcuts(Qt::KeySequence::New());
$newAct->setStatusTip(this->tr('Create a file'));
this->connect($newAct, SIGNAL 'triggered()', this, SLOT 'newFile()');
# [4]
my $openAct = this->{openAct} = Qt::Action(this->tr('&Open...'), this);
$openAct->setShortcuts(Qt::KeySequence::Open());
$openAct->setStatusTip(this->tr('Open an existing file'));
this->connect($openAct, SIGNAL 'triggered()', this, SLOT 'open()');
# [5]
my $saveAct = this->{saveAct} = Qt::Action(this->tr('&Save'), this);
$saveAct->setShortcuts(Qt::KeySequence::Save());
$saveAct->setStatusTip(this->tr('Save the document to disk'));
this->connect($saveAct, SIGNAL 'triggered()', this, SLOT 'save()');
my $printAct = this->{printAct} = Qt::Action(this->tr('&Print...'), this);
$printAct->setShortcuts(Qt::KeySequence::Print());
$printAct->setStatusTip(this->tr('Print the document'));
this->connect($printAct, SIGNAL 'triggered()', this, SLOT 'print()');
my $exitAct = this->{exitAct} = Qt::Action(this->tr('E&xit'), this);
$exitAct->setShortcut(Qt::KeySequence(this->tr('Ctrl+Q')));
$exitAct->setStatusTip(this->tr('Exit the application'));
this->connect($exitAct, SIGNAL 'triggered()', this, SLOT 'close()');
my $undoAct = this->{undoAct} = Qt::Action(this->tr('&Undo'), this);
$undoAct->setShortcuts(Qt::KeySequence::Undo());
$undoAct->setStatusTip(this->tr('Undo the last operation'));
this->connect($undoAct, SIGNAL 'triggered()', this, SLOT 'undo()');
my $redoAct = this->{redoAct} = Qt::Action(this->tr('&Redo'), this);
$redoAct->setShortcuts(Qt::KeySequence::Redo());
$redoAct->setStatusTip(this->tr('Redo the last operation'));
this->connect($redoAct, SIGNAL 'triggered()', this, SLOT 'redo()');
my $cutAct = this->{cutAct} = Qt::Action(this->tr('Cu&t'), this);
$cutAct->setShortcuts(Qt::KeySequence::Cut());
$cutAct->setStatusTip(this->tr('Cut the current selection\'s contents to the ' .
'clipboard'));
this->connect($cutAct, SIGNAL 'triggered()', this, SLOT 'cut()');
my $copyAct = this->{copyAct} = Qt::Action(this->tr('&Copy'), this);
$copyAct->setShortcut(Qt::KeySequence(this->tr('Ctrl+C')));
$copyAct->setStatusTip(this->tr('Copy the current selection\'s contents to the ' .
'clipboard'));
this->connect($copyAct, SIGNAL 'triggered()', this, SLOT 'copy()');
my $pasteAct = this->{pasteAct} = Qt::Action(this->tr('&Paste'), this);
$pasteAct->setShortcuts(Qt::KeySequence::Paste());
$pasteAct->setStatusTip(this->tr('Paste the clipboard\'s contents into the current ' .
'selection'));
this->connect($pasteAct, SIGNAL 'triggered()', this, SLOT 'paste()');
my $boldAct = this->{boldAct} = Qt::Action(this->tr('&Bold'), this);
$boldAct->setCheckable(1);
$boldAct->setShortcut(Qt::KeySequence(this->tr('Ctrl+B')));
$boldAct->setStatusTip(this->tr('Make the text bold'));
this->connect($boldAct, SIGNAL 'triggered()', this, SLOT 'bold()');
my $boldFont = $boldAct->font();
$boldFont->setBold(1);
$boldAct->setFont($boldFont);
my $italicAct = this->{italicAct} = Qt::Action(this->tr('&Italic'), this);
$italicAct->setCheckable(1);
$italicAct->setShortcut(Qt::KeySequence(this->tr('Ctrl+I')));
$italicAct->setStatusTip(this->tr('Make the text italic'));
this->connect($italicAct, SIGNAL 'triggered()', this, SLOT 'italic()');
my $italicFont = $italicAct->font();
$italicFont->setItalic(1);
$italicAct->setFont($italicFont);
my $setLineSpacingAct = this->{setLineSpacingAct} = Qt::Action(this->tr('Set &Line Spacing...'), this);
$setLineSpacingAct->setStatusTip(this->tr('Change the gap between the lines of a ' .
'paragraph'));
this->connect($setLineSpacingAct, SIGNAL 'triggered()', this, SLOT 'setLineSpacing()');
my $setParagraphSpacingAct = this->{setParagraphSpacingAct} = Qt::Action(this->tr('Set &Paragraph Spacing...'), this);
$setLineSpacingAct->setStatusTip(this->tr('Change the gap between paragraphs'));
this->connect($setParagraphSpacingAct, SIGNAL 'triggered()',
this, SLOT 'setParagraphSpacing()');
my $aboutAct = this->{aboutAct} = Qt::Action(this->tr('&About'), this);
$aboutAct->setStatusTip(this->tr('Show the application\'s About box'));
this->connect($aboutAct, SIGNAL 'triggered()', this, SLOT 'about()');
my $aboutQtAct = this->{aboutQtAct} = Qt::Action(this->tr('About &Qt'), this);
$aboutQtAct->setStatusTip(this->tr('Show the Qt4 library\'s About box'));
this->connect($aboutQtAct, SIGNAL 'triggered()', qApp, SLOT 'aboutQt()');
this->connect($aboutQtAct, SIGNAL 'triggered()', this, SLOT 'aboutQt()');
my $leftAlignAct = this->{leftAlignAct} = Qt::Action(this->tr('&Left Align'), this);
$leftAlignAct->setCheckable(1);
$leftAlignAct->setShortcut(Qt::KeySequence(this->tr('Ctrl+L')));
$leftAlignAct->setStatusTip(this->tr('Left align the selected text'));
this->connect($leftAlignAct, SIGNAL 'triggered()', this, SLOT 'leftAlign()');
my $rightAlignAct = this->{rightAlignAct} = Qt::Action(this->tr('&Right Align'), this);
$rightAlignAct->setCheckable(1);
$rightAlignAct->setShortcut(Qt::KeySequence(this->tr('Ctrl+R')));
$rightAlignAct->setStatusTip(this->tr('Right align the selected text'));
this->connect($rightAlignAct, SIGNAL 'triggered()', this, SLOT 'rightAlign()');
my $justifyAct = this->{justifyAct} = Qt::Action(this->tr('&Justify'), this);
$justifyAct->setCheckable(1);
$justifyAct->setShortcut(Qt::KeySequence(this->tr('Ctrl+J')));
$justifyAct->setStatusTip(this->tr('Justify the selected text'));
this->connect($justifyAct, SIGNAL 'triggered()', this, SLOT 'justify()');
( run in 0.560 second using v1.01-cache-2.11-cpan-2398b32b56e )