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

QActionGroup::checkedAction() bug

XMLWordPrintable

    • 2cdea6a10da75b7b8870f27c432a5e02f7500340

      Since QAction group does not monitor the state of the checked action it can in some cases return a QAction that is not checked. This can happen when the current checked action is set as unchecked after it has been returned from QActionGroup.

      QActionGroup::checkedAction() may return an action that is not checked.

      Here is the source code from Qt 4.3.1:

      /*!
      Returns the currently checked action in the group, or 0 if none
      are checked.
      */
      QAction *QActionGroup::checkedAction() const
      {
      Q_D(const QActionGroup);
      return d->current;
      }

      If doing something like:

      QAction *l_action = group->checkedAction();
      if (l_action)
      {
      l_action->setChecked(false);
      if (l_action == group->checkedAction())

      { qWarning("BUG"); }

      }

      Since QActionGroup did not monitor checked state changes of its actions,
      it will not set its d->current to 0.

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

            vfm Thierry Bastian (closed Nokia identity) (Inactive)
            admin Administrator
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes