diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-05-13 14:38:44 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-05-13 14:38:44 (GMT) |
commit | 5c42e4328cc2bea53dc4d31eb3f4d10d42ac6ee1 (patch) | |
tree | 712cb1697a1f09439f77219c44ed90fb0223ff49 /examples | |
parent | fdd2ad0813a856a00cac83ccff9bdd210b398c9c (diff) | |
parent | 9820412d2551b655fec24ffde7b2a56e3ad168ea (diff) | |
download | Qt-5c42e4328cc2bea53dc4d31eb3f4d10d42ac6ee1.zip Qt-5c42e4328cc2bea53dc4d31eb3f4d10d42ac6ee1.tar.gz Qt-5c42e4328cc2bea53dc4d31eb3f4d10d42ac6ee1.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'examples')
36 files changed, 93 insertions, 76 deletions
diff --git a/examples/assistant/simpletextviewer/mainwindow.cpp b/examples/assistant/simpletextviewer/mainwindow.cpp index cc2f3c0..f7c7098 100644 --- a/examples/assistant/simpletextviewer/mainwindow.cpp +++ b/examples/assistant/simpletextviewer/mainwindow.cpp @@ -101,11 +101,11 @@ void MainWindow::open() void MainWindow::createActions() { assistantAct = new QAction(tr("Help Contents"), this); - assistantAct->setShortcut(tr("F1")); + assistantAct->setShortcuts(QKeySequence::HelpContents); connect(assistantAct, SIGNAL(triggered()), this, SLOT(assistant())); openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcuts(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); clearAct = new QAction(tr("&Clear"), this); @@ -113,7 +113,7 @@ void MainWindow::createActions() connect(clearAct, SIGNAL(triggered()), textViewer, SLOT(clear())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/draganddrop/puzzle/mainwindow.cpp b/examples/draganddrop/puzzle/mainwindow.cpp index f998882..9035442 100644 --- a/examples/draganddrop/puzzle/mainwindow.cpp +++ b/examples/draganddrop/puzzle/mainwindow.cpp @@ -120,10 +120,10 @@ void MainWindow::setupMenus() QMenu *fileMenu = menuBar()->addMenu(tr("&File")); QAction *openAction = fileMenu->addAction(tr("&Open...")); - openAction->setShortcut(QKeySequence(tr("Ctrl+O"))); + openAction->setShortcuts(QKeySequence::Open); QAction *exitAction = fileMenu->addAction(tr("E&xit")); - exitAction->setShortcut(QKeySequence(tr("Ctrl+Q"))); + exitAction->setShortcuts(QKeySequence::Quit); QMenu *gameMenu = menuBar()->addMenu(tr("&Game")); diff --git a/examples/graphicsview/diagramscene/mainwindow.cpp b/examples/graphicsview/diagramscene/mainwindow.cpp index b536a7a..78fac30 100644 --- a/examples/graphicsview/diagramscene/mainwindow.cpp +++ b/examples/graphicsview/diagramscene/mainwindow.cpp @@ -401,7 +401,7 @@ void MainWindow::createActions() this, SLOT(deleteItem())); exitAction = new QAction(tr("E&xit"), this); - exitAction->setShortcut(tr("Ctrl+X")); + exitAction->setShortcuts(QKeySequence::Quit); exitAction->setStatusTip(tr("Quit Scenediagram example")); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); diff --git a/examples/help/simpletextviewer/mainwindow.cpp b/examples/help/simpletextviewer/mainwindow.cpp index fc9af58..33092ca 100644 --- a/examples/help/simpletextviewer/mainwindow.cpp +++ b/examples/help/simpletextviewer/mainwindow.cpp @@ -102,12 +102,12 @@ void MainWindow::open() void MainWindow::createActions() { assistantAct = new QAction(tr("Help Contents"), this); - assistantAct->setShortcut(tr("F1")); + assistantAct->setShortcut(QKeySequence::HelpContents); connect(assistantAct, SIGNAL(triggered()), this, SLOT(showDocumentation())); //! [4] openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcut(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); clearAct = new QAction(tr("&Clear"), this); @@ -115,7 +115,7 @@ void MainWindow::createActions() connect(clearAct, SIGNAL(triggered()), textViewer, SLOT(clear())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/itemviews/chart/mainwindow.cpp b/examples/itemviews/chart/mainwindow.cpp index 208a465..d065558 100644 --- a/examples/itemviews/chart/mainwindow.cpp +++ b/examples/itemviews/chart/mainwindow.cpp @@ -48,11 +48,11 @@ MainWindow::MainWindow() { QMenu *fileMenu = new QMenu(tr("&File"), this); QAction *openAction = fileMenu->addAction(tr("&Open...")); - openAction->setShortcut(QKeySequence(tr("Ctrl+O"))); + openAction->setShortcuts(QKeySequence::Open); QAction *saveAction = fileMenu->addAction(tr("&Save As...")); - saveAction->setShortcut(QKeySequence(tr("Ctrl+S"))); + saveAction->setShortcuts(QKeySequence::SaveAs); QAction *quitAction = fileMenu->addAction(tr("E&xit")); - quitAction->setShortcut(QKeySequence(tr("Ctrl+Q"))); + quitAction->setShortcuts(QKeySequence::Quit); setupModel(); setupViews(); diff --git a/examples/itemviews/pixelator/mainwindow.cpp b/examples/itemviews/pixelator/mainwindow.cpp index a2b98cf..80cfc5c 100644 --- a/examples/itemviews/pixelator/mainwindow.cpp +++ b/examples/itemviews/pixelator/mainwindow.cpp @@ -79,14 +79,14 @@ MainWindow::MainWindow() QMenu *fileMenu = new QMenu(tr("&File"), this); QAction *openAction = fileMenu->addAction(tr("&Open...")); - openAction->setShortcut(QKeySequence(tr("Ctrl+O"))); + openAction->setShortcuts(QKeySequence::Open); printAction = fileMenu->addAction(tr("&Print...")); printAction->setEnabled(false); - printAction->setShortcut(QKeySequence(tr("Ctrl+P"))); + printAction->setShortcut(QKeySequence::Print); QAction *quitAction = fileMenu->addAction(tr("E&xit")); - quitAction->setShortcut(QKeySequence(tr("Ctrl+Q"))); + quitAction->setShortcuts(QKeySequence::Quit); QMenu *helpMenu = new QMenu(tr("&Help"), this); QAction *aboutAction = helpMenu->addAction(tr("&About")); diff --git a/examples/itemviews/puzzle/mainwindow.cpp b/examples/itemviews/puzzle/mainwindow.cpp index c6088f6..a5ba236 100644 --- a/examples/itemviews/puzzle/mainwindow.cpp +++ b/examples/itemviews/puzzle/mainwindow.cpp @@ -107,10 +107,10 @@ void MainWindow::setupMenus() QMenu *fileMenu = menuBar()->addMenu(tr("&File")); QAction *openAction = fileMenu->addAction(tr("&Open...")); - openAction->setShortcut(QKeySequence(tr("Ctrl+O"))); + openAction->setShortcuts(QKeySequence::Open); QAction *exitAction = fileMenu->addAction(tr("E&xit")); - exitAction->setShortcut(QKeySequence(tr("Ctrl+Q"))); + exitAction->setShortcuts(QKeySequence::Quit); QMenu *gameMenu = menuBar()->addMenu(tr("&Game")); diff --git a/examples/itemviews/simpledommodel/mainwindow.cpp b/examples/itemviews/simpledommodel/mainwindow.cpp index ac96899..73626b1 100644 --- a/examples/itemviews/simpledommodel/mainwindow.cpp +++ b/examples/itemviews/simpledommodel/mainwindow.cpp @@ -50,9 +50,9 @@ MainWindow::MainWindow() : QMainWindow(), model(0) { fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->addAction(tr("&Open..."), this, SLOT(openFile()), - QKeySequence(tr("Ctrl+O"))); + QKeySequence::Open); fileMenu->addAction(tr("E&xit"), this, SLOT(close()), - QKeySequence(tr("Ctrl+Q"))); + QKeySequence::Quit); model = new DomModel(QDomDocument(), this); view = new QTreeView(this); diff --git a/examples/linguist/arrowpad/mainwindow.cpp b/examples/linguist/arrowpad/mainwindow.cpp index a167cc2..37b9362 100644 --- a/examples/linguist/arrowpad/mainwindow.cpp +++ b/examples/linguist/arrowpad/mainwindow.cpp @@ -53,7 +53,7 @@ MainWindow::MainWindow() //! [1] exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); //! [1] diff --git a/examples/mainwindows/application/mainwindow.cpp b/examples/mainwindows/application/mainwindow.cpp index 9a22254..cf36332 100644 --- a/examples/mainwindows/application/mainwindow.cpp +++ b/examples/mainwindows/application/mainwindow.cpp @@ -174,7 +174,7 @@ void MainWindow::createActions() //! [20] exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); //! [20] exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); diff --git a/examples/mainwindows/dockwidgets/mainwindow.cpp b/examples/mainwindows/dockwidgets/mainwindow.cpp index 1683034..4ccd2f1 100644 --- a/examples/mainwindows/dockwidgets/mainwindow.cpp +++ b/examples/mainwindows/dockwidgets/mainwindow.cpp @@ -242,7 +242,7 @@ void MainWindow::createActions() connect(undoAct, SIGNAL(triggered()), this, SLOT(undo())); quitAct = new QAction(tr("&Quit"), this); - quitAct->setShortcut(tr("Ctrl+Q")); + quitAct->setShortcuts(QKeySequence::Quit); quitAct->setStatusTip(tr("Quit the application")); connect(quitAct, SIGNAL(triggered()), this, SLOT(close())); diff --git a/examples/mainwindows/mdi/mainwindow.cpp b/examples/mainwindows/mdi/mainwindow.cpp index 49f9b21..e6e3e6e 100644 --- a/examples/mainwindows/mdi/mainwindow.cpp +++ b/examples/mainwindows/mdi/mainwindow.cpp @@ -235,7 +235,7 @@ void MainWindow::createActions() //! [0] exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); //! [0] diff --git a/examples/mainwindows/menus/mainwindow.cpp b/examples/mainwindows/menus/mainwindow.cpp index 4c10f73..08a3c31 100644 --- a/examples/mainwindows/menus/mainwindow.cpp +++ b/examples/mainwindows/menus/mainwindow.cpp @@ -219,7 +219,7 @@ void MainWindow::createActions() connect(printAct, SIGNAL(triggered()), this, SLOT(print())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); @@ -240,7 +240,7 @@ void MainWindow::createActions() connect(cutAct, SIGNAL(triggered()), this, SLOT(cut())); copyAct = new QAction(tr("&Copy"), this); - copyAct->setShortcut(tr("Ctrl+C")); + copyAct->setShortcuts(QKeySequence::Copy); copyAct->setStatusTip(tr("Copy the current selection's contents to the " "clipboard")); connect(copyAct, SIGNAL(triggered()), this, SLOT(copy())); @@ -253,7 +253,7 @@ void MainWindow::createActions() boldAct = new QAction(tr("&Bold"), this); boldAct->setCheckable(true); - boldAct->setShortcut(tr("Ctrl+B")); + boldAct->setShortcut(QKeySequence::Bold); boldAct->setStatusTip(tr("Make the text bold")); connect(boldAct, SIGNAL(triggered()), this, SLOT(bold())); @@ -263,7 +263,7 @@ void MainWindow::createActions() italicAct = new QAction(tr("&Italic"), this); italicAct->setCheckable(true); - italicAct->setShortcut(tr("Ctrl+I")); + italicAct->setShortcut(QKeySequence::Italic); italicAct->setStatusTip(tr("Make the text italic")); connect(italicAct, SIGNAL(triggered()), this, SLOT(italic())); diff --git a/examples/mainwindows/recentfiles/mainwindow.cpp b/examples/mainwindows/recentfiles/mainwindow.cpp index c8c2f88..5746863 100644 --- a/examples/mainwindows/recentfiles/mainwindow.cpp +++ b/examples/mainwindows/recentfiles/mainwindow.cpp @@ -132,7 +132,7 @@ void MainWindow::createActions() } exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); diff --git a/examples/mainwindows/sdi/mainwindow.cpp b/examples/mainwindows/sdi/mainwindow.cpp index 61d63b3..e7e05ee 100644 --- a/examples/mainwindows/sdi/mainwindow.cpp +++ b/examples/mainwindows/sdi/mainwindow.cpp @@ -180,7 +180,7 @@ void MainWindow::createActions() connect(closeAct, SIGNAL(triggered()), this, SLOT(close())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); diff --git a/examples/opengl/grabber/mainwindow.cpp b/examples/opengl/grabber/mainwindow.cpp index 7e878f9..9e27023 100644 --- a/examples/opengl/grabber/mainwindow.cpp +++ b/examples/opengl/grabber/mainwindow.cpp @@ -136,7 +136,7 @@ void MainWindow::createActions() connect(clearPixmapAct, SIGNAL(triggered()), this, SLOT(clearPixmap())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/painting/svgviewer/mainwindow.cpp b/examples/painting/svgviewer/mainwindow.cpp index 22393eb..64f35ed 100644 --- a/examples/painting/svgviewer/mainwindow.cpp +++ b/examples/painting/svgviewer/mainwindow.cpp @@ -53,7 +53,7 @@ MainWindow::MainWindow() QAction *openAction = fileMenu->addAction(tr("&Open...")); openAction->setShortcut(QKeySequence(tr("Ctrl+O"))); QAction *quitAction = fileMenu->addAction(tr("E&xit")); - quitAction->setShortcut(QKeySequence(tr("Ctrl+Q"))); + quitAction->setShortcuts(QKeySequence::Quit); menuBar()->addMenu(fileMenu); diff --git a/examples/phonon/musicplayer/mainwindow.cpp b/examples/phonon/musicplayer/mainwindow.cpp index f50a2bd..30c6d05 100644 --- a/examples/phonon/musicplayer/mainwindow.cpp +++ b/examples/phonon/musicplayer/mainwindow.cpp @@ -261,7 +261,7 @@ void MainWindow::setupActions() addFilesAction = new QAction(tr("Add &Files"), this); addFilesAction->setShortcut(tr("Ctrl+F")); exitAction = new QAction(tr("E&xit"), this); - exitAction->setShortcut(tr("Ctrl+X")); + exitAction->setShortcuts(QKeySequence::Quit); aboutAction = new QAction(tr("A&bout"), this); aboutAction->setShortcut(tr("Ctrl+B")); aboutQtAction = new QAction(tr("About &Qt"), this); diff --git a/examples/richtext/orderform/mainwindow.cpp b/examples/richtext/orderform/mainwindow.cpp index e5cffe3..7e460b7 100644 --- a/examples/richtext/orderform/mainwindow.cpp +++ b/examples/richtext/orderform/mainwindow.cpp @@ -49,12 +49,12 @@ MainWindow::MainWindow() { QMenu *fileMenu = new QMenu(tr("&File"), this); QAction *newAction = fileMenu->addAction(tr("&New...")); - newAction->setShortcut(tr("Ctrl+N")); + newAction->setShortcuts(QKeySequence::New); printAction = fileMenu->addAction(tr("&Print..."), this, SLOT(printFile())); - printAction->setShortcut(tr("Ctrl+P")); + printAction->setShortcuts(QKeySequence::Print); printAction->setEnabled(false); QAction *quitAction = fileMenu->addAction(tr("E&xit")); - quitAction->setShortcut(tr("Ctrl+Q")); + quitAction->setShortcuts(QKeySequence::Quit); menuBar()->addMenu(fileMenu); letters = new QTabWidget; diff --git a/examples/richtext/syntaxhighlighter/mainwindow.cpp b/examples/richtext/syntaxhighlighter/mainwindow.cpp index a6312f9..0d1b41f 100644 --- a/examples/richtext/syntaxhighlighter/mainwindow.cpp +++ b/examples/richtext/syntaxhighlighter/mainwindow.cpp @@ -110,14 +110,13 @@ void MainWindow::setupFileMenu() menuBar()->addMenu(fileMenu); fileMenu->addAction(tr("&New"), this, SLOT(newFile()), - QKeySequence(tr("Ctrl+N", - "File|New"))); + QKeySequence::New); + fileMenu->addAction(tr("&Open..."), this, SLOT(openFile()), - QKeySequence(tr("Ctrl+O", - "File|Open"))); + QKeySequence::Open); + fileMenu->addAction(tr("E&xit"), qApp, SLOT(quit()), - QKeySequence(tr("Ctrl+Q", - "File|Exit"))); + QKeySequence::Quit); } void MainWindow::setupHelpMenu() diff --git a/examples/sql/masterdetail/mainwindow.cpp b/examples/sql/masterdetail/mainwindow.cpp index 67825d6..5bf4cb9 100644 --- a/examples/sql/masterdetail/mainwindow.cpp +++ b/examples/sql/masterdetail/mainwindow.cpp @@ -362,7 +362,7 @@ void MainWindow::createMenuBar() addAction->setShortcut(tr("Ctrl+A")); deleteAction->setShortcut(tr("Ctrl+D")); - quitAction->setShortcut(tr("Ctrl+Q")); + quitAction->setShortcuts(QKeySequence::Quit); QMenu *fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->addAction(addAction); diff --git a/examples/tools/codecs/mainwindow.cpp b/examples/tools/codecs/mainwindow.cpp index 1e6fa69..5d3b7ac 100644 --- a/examples/tools/codecs/mainwindow.cpp +++ b/examples/tools/codecs/mainwindow.cpp @@ -156,7 +156,7 @@ void MainWindow::findCodecs() void MainWindow::createActions() { openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcuts(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); foreach (QTextCodec *codec, codecs) { @@ -169,7 +169,7 @@ void MainWindow::createActions() } exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/tools/plugandpaint/mainwindow.cpp b/examples/tools/plugandpaint/mainwindow.cpp index 224bc71..f61359b 100644 --- a/examples/tools/plugandpaint/mainwindow.cpp +++ b/examples/tools/plugandpaint/mainwindow.cpp @@ -179,15 +179,15 @@ void MainWindow::aboutPlugins() void MainWindow::createActions() { openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcuts(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); saveAsAct = new QAction(tr("&Save As..."), this); - saveAsAct->setShortcut(tr("Ctrl+S")); + saveAsAct->setShortcuts(QKeySequence::SaveAs); connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); brushColorAct = new QAction(tr("&Brush Color..."), this); diff --git a/examples/tools/settingseditor/mainwindow.cpp b/examples/tools/settingseditor/mainwindow.cpp index 0f48a5c..0321b55 100644 --- a/examples/tools/settingseditor/mainwindow.cpp +++ b/examples/tools/settingseditor/mainwindow.cpp @@ -122,7 +122,7 @@ void MainWindow::about() void MainWindow::createActions() { openSettingsAct = new QAction(tr("&Open Application Settings..."), this); - openSettingsAct->setShortcut(tr("Ctrl+O")); + openSettingsAct->setShortcuts(QKeySequence::Open); connect(openSettingsAct, SIGNAL(triggered()), this, SLOT(openSettings())); openIniFileAct = new QAction(tr("Open I&NI File..."), this); @@ -146,7 +146,7 @@ void MainWindow::createActions() connect(refreshAct, SIGNAL(triggered()), settingsTree, SLOT(refresh())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); autoRefreshAct = new QAction(tr("&Auto-Refresh"), this); diff --git a/examples/tools/undoframework/mainwindow.cpp b/examples/tools/undoframework/mainwindow.cpp index f912ff2..bf0aa41 100644 --- a/examples/tools/undoframework/mainwindow.cpp +++ b/examples/tools/undoframework/mainwindow.cpp @@ -101,16 +101,14 @@ void MainWindow::createActions() //! [5] undoAction = undoStack->createUndoAction(this, tr("&Undo")); - undoAction->setShortcut(tr("Ctrl+Z")); + undoAction->setShortcuts(QKeySequence::Undo); redoAction = undoStack->createRedoAction(this, tr("&Redo")); - QList<QKeySequence> redoShortcuts; - redoShortcuts << tr("Ctrl+Y") << tr("Shift+Ctrl+Z"); - redoAction->setShortcuts(redoShortcuts); + redoAction->setShortcuts(QKeySequence::Redo); //! [5] exitAction = new QAction(tr("E&xit"), this); - exitAction->setShortcut(tr("Ctrl+Q")); + exitAction->setShortcuts(QKeySequence::Quit); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); aboutAction = new QAction(tr("&About"), this); diff --git a/examples/webkit/fancybrowser/mainwindow.cpp b/examples/webkit/fancybrowser/mainwindow.cpp index bf61f9c..e24f6cf 100644 --- a/examples/webkit/fancybrowser/mainwindow.cpp +++ b/examples/webkit/fancybrowser/mainwindow.cpp @@ -43,6 +43,8 @@ #include <QtWebKit> #include "mainwindow.h" +//! [1] + MainWindow::MainWindow() { progress = 0; @@ -52,7 +54,9 @@ MainWindow::MainWindow() file.open(QIODevice::ReadOnly); jQuery = file.readAll(); file.close(); +//! [1] +//! [2] view = new QWebView(this); view->load(QUrl("http://www.google.com/ncr")); connect(view, SIGNAL(loadFinished(bool)), SLOT(adjustLocation())); @@ -70,7 +74,9 @@ MainWindow::MainWindow() toolBar->addAction(view->pageAction(QWebPage::Reload)); toolBar->addAction(view->pageAction(QWebPage::Stop)); toolBar->addWidget(locationEdit); +//! [2] +//! [3] QMenu *effectMenu = menuBar()->addMenu(tr("&Effect")); effectMenu->addAction("Highlight all links", this, SLOT(highlightAllLinks())); @@ -89,7 +95,9 @@ MainWindow::MainWindow() setCentralWidget(view); } +//! [3] +//! [4] void MainWindow::adjustLocation() { locationEdit->setText(view->url().toString()); @@ -98,11 +106,12 @@ void MainWindow::adjustLocation() void MainWindow::changeLocation() { QUrl url = QUrl(locationEdit->text()); - locationEdit->setText(url.toString()); view->load(url); view->setFocus(); } +//! [4] +//! [5] void MainWindow::adjustTitle() { if (progress <= 0 || progress >= 100) @@ -116,20 +125,26 @@ void MainWindow::setProgress(int p) progress = p; adjustTitle(); } +//! [5] +//! [6] void MainWindow::finishLoading(bool) { progress = 100; adjustTitle(); view->page()->mainFrame()->evaluateJavaScript(jQuery); } +//! [6] +//! [7] void MainWindow::highlightAllLinks() { QString code = "$('a').each( function () { $(this).css('background-color', 'yellow') } )"; view->page()->mainFrame()->evaluateJavaScript(code); } +//! [7] +//! [8] void MainWindow::rotateImages(bool toggle) { QString code = "$('img').each( function () { $(this).css('-webkit-transition', '-webkit-transform 2s') } )"; @@ -140,7 +155,9 @@ void MainWindow::rotateImages(bool toggle) code = "$('img').each( function () { $(this).css('-webkit-transform', 'rotate(0deg)') } )"; view->page()->mainFrame()->evaluateJavaScript(code); } +//! [8] +//! [9] void MainWindow::removeGifImages() { QString code = "$('[src*=gif]').remove()"; @@ -164,4 +181,5 @@ void MainWindow::removeEmbeddedElements() QString code = "$('embed').remove()"; view->page()->mainFrame()->evaluateJavaScript(code); } +//! [9] diff --git a/examples/webkit/fancybrowser/mainwindow.h b/examples/webkit/fancybrowser/mainwindow.h index 9362ca7..2e1068c 100644 --- a/examples/webkit/fancybrowser/mainwindow.h +++ b/examples/webkit/fancybrowser/mainwindow.h @@ -39,13 +39,14 @@ ** ****************************************************************************/ -#include <QMainWindow> +#include <QtGui> QT_BEGIN_NAMESPACE class QWebView; class QLineEdit; QT_END_NAMESPACE +//! [1] class MainWindow : public QMainWindow { Q_OBJECT @@ -73,4 +74,5 @@ private: QWebView *view; QLineEdit *locationEdit; int progress; +//! [1] }; diff --git a/examples/webkit/formextractor/mainwindow.cpp b/examples/webkit/formextractor/mainwindow.cpp index 222d9b2..ec4d043 100644 --- a/examples/webkit/formextractor/mainwindow.cpp +++ b/examples/webkit/formextractor/mainwindow.cpp @@ -54,7 +54,7 @@ void MainWindow::createActions() { exitAct = new QAction(tr("E&xit"), this); exitAct->setStatusTip(tr("Exit the application")); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/webkit/previewer/mainwindow.cpp b/examples/webkit/previewer/mainwindow.cpp index abe7941..1e20ed3 100644 --- a/examples/webkit/previewer/mainwindow.cpp +++ b/examples/webkit/previewer/mainwindow.cpp @@ -61,7 +61,7 @@ MainWindow::MainWindow() void MainWindow::createActions() { openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcuts(QKeySequence::Open); openAct->setStatusTip(tr("Open an existing HTML file")); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); @@ -72,13 +72,13 @@ void MainWindow::createActions() //! [1] saveAct = new QAction(tr("&Save"), this); - saveAct->setShortcut(tr("Ctrl+S")); + saveAct->setShortcuts(QKeySequence::Save); saveAct->setStatusTip(tr("Save the HTML file to disk")); connect(saveAct, SIGNAL(triggered()), this, SLOT(save())); exitAct = new QAction(tr("E&xit"), this); exitAct->setStatusTip(tr("Exit the application")); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/widgets/icons/mainwindow.cpp b/examples/widgets/icons/mainwindow.cpp index 00ce8b0..db42710 100644 --- a/examples/widgets/icons/mainwindow.cpp +++ b/examples/widgets/icons/mainwindow.cpp @@ -369,7 +369,7 @@ void MainWindow::createActions() this, SLOT(removeAllImages())); exitAct = new QAction(tr("&Quit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); styleActionGroup = new QActionGroup(this); diff --git a/examples/widgets/scribble/mainwindow.cpp b/examples/widgets/scribble/mainwindow.cpp index ad1a837..c4b05fe 100644 --- a/examples/widgets/scribble/mainwindow.cpp +++ b/examples/widgets/scribble/mainwindow.cpp @@ -141,7 +141,7 @@ void MainWindow::createActions() //! [13] //! [14] { openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcuts(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); foreach (QByteArray format, QImageWriter::supportedImageFormats()) { @@ -157,7 +157,7 @@ void MainWindow::createActions() connect(printAct, SIGNAL(triggered()), scribbleArea, SLOT(print())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); penColorAct = new QAction(tr("&Pen Color..."), this); diff --git a/examples/widgets/tablet/mainwindow.cpp b/examples/widgets/tablet/mainwindow.cpp index 56a10cd..10490bf 100644 --- a/examples/widgets/tablet/mainwindow.cpp +++ b/examples/widgets/tablet/mainwindow.cpp @@ -212,17 +212,17 @@ void MainWindow::createActions() this, SLOT(lineWidthActionTriggered(QAction *))); exitAction = new QAction(tr("E&xit"), this); - exitAction->setShortcut(tr("Ctrl+X")); + exitAction->setShortcuts(QKeySequence::Quit); connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); loadAction = new QAction(tr("&Open..."), this); - loadAction->setShortcut(tr("Ctrl+O")); + loadAction->setShortcuts(QKeySequence::Open); connect(loadAction, SIGNAL(triggered()), this, SLOT(loadAct())); saveAction = new QAction(tr("&Save As..."), this); - saveAction->setShortcut(tr("Ctrl+S")); + saveAction->setShortcuts(QKeySequence::SaveAs); connect(saveAction, SIGNAL(triggered()), this, SLOT(saveAct())); diff --git a/examples/xml/dombookmarks/mainwindow.cpp b/examples/xml/dombookmarks/mainwindow.cpp index 6b0c101..7efe6ff 100644 --- a/examples/xml/dombookmarks/mainwindow.cpp +++ b/examples/xml/dombookmarks/mainwindow.cpp @@ -113,15 +113,15 @@ void MainWindow::about() void MainWindow::createActions() { openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcuts(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); saveAsAct = new QAction(tr("&Save As..."), this); - saveAsAct->setShortcut(tr("Ctrl+S")); + saveAsAct->setShortcuts(QKeySequence::SaveAs); connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/xml/saxbookmarks/mainwindow.cpp b/examples/xml/saxbookmarks/mainwindow.cpp index 2cba559..9247eb7 100644 --- a/examples/xml/saxbookmarks/mainwindow.cpp +++ b/examples/xml/saxbookmarks/mainwindow.cpp @@ -128,15 +128,15 @@ void MainWindow::about() void MainWindow::createActions() { openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcuts(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); saveAsAct = new QAction(tr("&Save As..."), this); - saveAsAct->setShortcut(tr("Ctrl+S")); + saveAsAct->setShortcuts(QKeySequence::SaveAs); connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/xml/streambookmarks/mainwindow.cpp b/examples/xml/streambookmarks/mainwindow.cpp index 2136b4b..c6f991b 100644 --- a/examples/xml/streambookmarks/mainwindow.cpp +++ b/examples/xml/streambookmarks/mainwindow.cpp @@ -141,15 +141,15 @@ void MainWindow::about() void MainWindow::createActions() { openAct = new QAction(tr("&Open..."), this); - openAct->setShortcut(tr("Ctrl+O")); + openAct->setShortcuts(QKeySequence::Open); connect(openAct, SIGNAL(triggered()), this, SLOT(open())); saveAsAct = new QAction(tr("&Save As..."), this); - saveAsAct->setShortcut(tr("Ctrl+S")); + saveAsAct->setShortcuts(QKeySequence::SaveAs); connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs())); exitAct = new QAction(tr("E&xit"), this); - exitAct->setShortcut(tr("Ctrl+Q")); + exitAct->setShortcuts(QKeySequence::Quit); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("&About"), this); diff --git a/examples/xmlpatterns/trafficinfo/mainwindow.cpp b/examples/xmlpatterns/trafficinfo/mainwindow.cpp index 1f754d5..393e33c 100644 --- a/examples/xmlpatterns/trafficinfo/mainwindow.cpp +++ b/examples/xmlpatterns/trafficinfo/mainwindow.cpp @@ -55,7 +55,7 @@ MainWindow::MainWindow() : QWidget(0, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint) { QAction *quitAction = new QAction(tr("E&xit"), this); - quitAction->setShortcut(tr("Ctrl+Q")); + quitAction->setShortcuts(QKeySequence::Quit); connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); QAction *configAction = new QAction(tr("&Select station..."), this); |