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

Context menus in a QGraphicsProxyWidget are not rendered properly on Mac.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • 4.8.x
    • 4.6.2
    • Widgets: GraphicsView
    • None
    • Mac OS X 10.6.3, Qt4.6.2, GCC4
    • macOS

    Description

      If you place a QLineEdit (or any other Qt widget that supports context menus) in a graphics view by means of a proxy widget, when right clicked the context menu is not shown above all other content. It appears the QMenu is being created with the widget as the parent. As a result it ends up being painted below all items in the graphics view and is clipped to the graphics view itself. This causes two problems:

      -the menu is below the content in the graphics view, so you can't see the menu actions you're trying to click on
      -on the Mac the menu does not show a drop shadow
      -if the graphics view is not large enough to show the context menu the menu ends up being clipped.

      Attached are screenshots showing the problem, as well as a small bit of code used to produce it.

      Note this occurs for the standard context menu for QLineEdit. If you change the context menu showing mode and setup actions (as shown in the example) the problem occurs as well. If you re implement contextMenuEvent in the Qt widget (by subclassing QLineEdit in this case) and creating the QMenu with no parent (aka 0 thus making it top level) the menu shows up just fine, but you can't show it in the correct location on the screen using globalPos.

      Attachments

        1. main.cpp
          2 kB
        2. contextMenuUnderContent.png
          contextMenuUnderContent.png
          28 kB
        3. contextMenuClipped.png
          contextMenuClipped.png
          12 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sorvig Morten Sørvig
            wstokes Will Stokes
            Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes