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

QWidget::actionsRef()

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.15.0
    • None
    • any

    • All

    Description

      I wonder why there is a

      QList<QAction *> QWidget::actions() const
      

      but no

      const QList<QAction *>& QWidget::actionsRef() const
      

      while `QWidget::actions() ` implementation is just a:

      QList<QAction*> QWidget::actions() const
      {
          Q_D(const QWidget);
          return d->actions;
      }
      

      Static analyzers are complaining

      warning: Don't call QList::operator[]() on temporary [-Wclazy-detaching-temporary]
      

      for

      QAction* action = m_menu.actions()[i];
      

      and it's annoying.

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            truf Alexander Trufanov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes