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

QWidgetAction cannot render complex widget correctly

XMLWordPrintable

    • macOS

      Reproducer attached. It shows a QMainWindow whose context menu event is overridden. By right click in the window a QMenu with a sub menu pops up. That sub menu is going to to show a QWidgetAction that should be a QLabel.

      The problem is that the QLabel is put into a layout which is set as the layout as a "root" QWidget. And that "root widget" is set as the default widget of QWidgetAction, i.e. "setDefaultWidget(pWidget);" inside PriorityActionWidget constructor. Then the result looks like:

      So actually QWidgetAction is not rendering its widget at all.

      The workaround I found so far is to set the label as the default widget, i.e. "setDefaultWidget(label);". Then QLabel is visible. But the result is not as pretty as expected. That is the reason I suspect that QWidgetAction may have problem dealing with "complex" widgets (QLabel->QLayout->QWidget) since a simple QLabel works.

      It is said that the latest "dev" branch can give expected result. I've tried the 6.10.0 snapshot that I download from online installer - the problem is still there. So some commits between that 6.10.0 snapshot being packed into online installer and the latest branch must have solved the problem. So please backport.

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            luqiaochen Luqiao Chen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes