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

QAction::setIconVisibleInMenu does not work.

    XMLWordPrintable

Details

    Description

      The Qt documentation states that setIconVisibleInMenu has priority over Qt::AA_DontShowIconsInMenus.
      Good. But unfortunatly it does not work in this case:

      if Qt::AA_DontShowIconsInMenus is set to TRUE
      then setIconVisibleInMenu(true) has no effect

      The bug is easy to identify in qaction.cpp in function:
      void QAction::setIconVisibleInMenu(bool visible)

      There is the line:

      if (visible != (bool)d->iconVisibleInMenu)

      But this if FALSE if d->iconVisibleInMenu is -1 and visible is true.
      The line should rather be:

      if ((int)visible != d->iconVisibleInMenu)

      Another related issue in the same function is the line:

      && visible == !QApplication::instance()->testAttribute(Qt::AA_DontShowIconsInMenus))) {

      should be changed for:

      && visible != !QApplication::instance()->testAttribute(Qt::AA_DontShowIconsInMenus))) {

      making these changes seems to restore expected functionality.

      Attachments

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

        Activity

          People

            vfm Thierry Bastian (closed Nokia identity) (Inactive)
            dettman Dean Dettman (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