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

Actions added imperatively to Menu after a menu separator don't show up

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.10
    • Quick: Controls 2
    • None

    Description

      The Font and Color actions should be visible, but aren't.

      import QtQuick
      import QtQuick.Controls
      
      ApplicationWindow {
          width: 400
          height: 400
          visible: true
      
          Action {
              id: fontDialogAction
              text: qsTr("Fon&t…")
              shortcut: "Ctrl+T"
          }
      
          Action {
              id: colorDialogAction
              text: qsTr("Color…")
              shortcut: "Ctrl+Shift+C"
          }
      
          Component {
              id: menuSeparatorComponent
      
              MenuSeparator {}
          }
      
          TextArea {
              id: textArea
              anchors.fill: parent
      
              Component.onCompleted: {
                  textArea.ContextMenu.menu.addItem(menuSeparatorComponent)
                  textArea.ContextMenu.menu.addAction(fontDialogAction)
                  textArea.ContextMenu.menu.addAction(colorDialogAction)
              }
          }
      }
      

      Still happens without using ContextMenu:

      import QtQuick
      import QtQuick.Controls
      
      ApplicationWindow {
          width: 400
          height: 400
          visible: true
      
          Menu {
              id: menu
      
              Action {
                  text: "First action"
              }
          }
      
          Action {
              id: fontDialogAction
              text: qsTr("Font")
          }
      
          Action {
              id: colorDialogAction
              text: qsTr("Color")
          }
      
          Component {
              id: menuSeparatorComponent
      
              MenuSeparator {}
          }
      
          Component.onCompleted: {
              menu.addItem(menuSeparatorComponent)
              menu.addAction(fontDialogAction)
              menu.addAction(colorDialogAction)
          }
      
          TapHandler {
              acceptedButtons: Qt.RightButton
              onPressedChanged: if (pressed) menu.popup()
          }
      }
      

      Attachments

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

        Activity

          People

            mitch_curtis Mitch Curtis
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes