Details
-
Bug
-
Resolution: Done
-
P4: Low
-
5.7.0
-
None
Description
In https://doc.qt.io/qt-5/qaction.html there are two code blocks right after the text section befinning with "Once a QAction has been created it should be added to the relevant menu and toolbar"
The code shown is the following:
const QIcon openIcon = QIcon::fromTheme("document-open", QIcon(":/images/open.png")); QAction *openAct = new QAction(openIcon, tr("&Open..."), this); openAct->setShortcuts(QKeySequence::Open); openAct->setStatusTip(tr("Open an existing file")); connect(openAct, &QAction::triggered, this, &MainWindow::open); fileMenu->addAction(openAct); fileToolBar->addAction(openAct);
And then without any further comment:
fileMenu->addAction(openAct);
To me it seems the second piece of code is too much here.