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

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



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


      Steps to Reproduce:

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


      • 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):


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



            • Assignee:
              qt.team.quick.subscriptions Qt Quick and Widgets Team
              erika Erika
            • Votes:
              1 Vote for this issue
              2 Start watching this issue


              • Created:

                Gerrit Reviews

                There are no open Gerrit changes