Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-56772

Extra code in docs?

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.11.2
    • 5.7.0
    • Documentation
    • 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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            paulwicking Paul Wicking
            icwiener Anonymous (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes