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

Incorrect QMenu behaviour with QMainWindow/QGLWidget

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.2.1, 5.3.0 Alpha
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Linux Mint 16 x64/Qt Creator 3.0.1/Qt5.2.1 and Qt5.3.0

      Description

      The behaviour of a QMenu when used with a QMainWindow/QGLWidget does not quite work as expected.

      My test case simply creates a QMainWindow, adds a QMenu named “File” with a single item to the menu bar and sets the central widget to an empty QGLWidget.

      In this case the following occurs:

      1. “File” is pressed and the menu opens, as expected.
      2. “File” is pressed again and the menu closes, as expected.
      3. “File” is pressed again and nothing happens, not as expected.
      4. “File” is pressed again and the menu opens.

      This behaviour repeats where only every other press opens the menu. However, the following does appear to work as expected:

      1. “File” is pressed and the menu opens, as expected.
      2. The empty central widget is pressed and the menu closes, as expected.
      3. “File” is pressed again and the menu opens, as expected. Etc.

      The menu also appears to work correctly if the menu is used (i.e. an item in the menu is clicked).

      If the central widget is swapped for a different widget (I tried a QPushButton), the menu works as I would expect, with each press of the file menu opening and closing the menu in turn.

      I have tested the case with Qt5.2.1 and Qt5.3.0 Alpha. The results are the same in both cases.

      A simple test case is attached.

        Attachments

        1. main.cpp
          0.2 kB
          Dan Allen
        2. qmenutestwindow.cpp
          0.5 kB
          Dan Allen
        3. qmenutestwindow.h
          0.3 kB
          Dan Allen
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            jolind Jorgen Lind
            Reporter:
            gsxruk Dan Allen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes