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

QAction visibility change in QMenu::aboutToShow results in poor menu placement

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.7.0
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Windows 7; MSVC2015

      Description

      Steps to Reproduce:

      • See attached main.cpp
      • Run, and place window near the bottom of the screen (see example image)
      • Select a menu

      Results:

      • Resulting popup menu is positioned in a weird/floating/unexpected location

      Expected Results:

      • Resulting popup menu is placed in nice alignment with the Menu title

      ------------------------------------------------------------------

      Updating the visibility of QActions in QMenu just before the menu is shown (QMenu::aboutToShow connection) results in poor placement of the menus. See the attached example image.

      It appears to draw poorly when the length of the menu - before visibility changes - exceeds available vertical drawing space. This is troublesome when your application has a QMenu with a long, long list of QActions, even though only a small subset are visible at any time.

      As noted, at the end of AboutToShow I've tried:

      • update, updateGeometry, adjustSize(), ensurePolished with both pMenu and pMenu->parentWidget()
      • invalidating the layout, but neither pMenu nor pMenu->parentWidget have a valid widget at this point.

      Posting this issue on the Qt Forums, it was recommended to file a bug (any related bugs in this database appear to have already been resolved):
      https://forum.qt.io/topic/68765/how-to-update-geometry-on-qaction-visibility-change-in-qmenu-abouttoshow/2

        Attachments

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

          Activity

            People

            • Assignee:
              mmutz Marc Mutz
              Reporter:
              erika Erika
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes