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

Qt Platform Menu QML Type cannot create sub menus on Windows

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.8.0
    • Fix Version/s: 5.9.0 Beta 1
    • Component/s: Quick: Controls 2
    • Labels:
      None
    • Commits:
      e6eaf29c69f0f352fc8279b9f508ae468d18cafd

      Description

      Qt 5.8.0 introduce new Qt.labs.platform module with Platform Menu implementation.
      I've try create context menu with sub menu like:

      import QtQuick 2.6
      import QtQuick.Window 2.2
      import Qt.labs.platform 1.0
      
      Window {
          width: 300
          height: 300
          visible: true
      
          MouseArea {
              anchors.fill: parent
              acceptedButtons: Qt.RightButton
              onClicked: menu.open()
          }
      
          Menu {
              id: menu
              Menu {
                  title: qsTr ("Sub Menu 1")
                  MenuItem {
                      text: "Sub Menu 1 Item"
                  }
              }
              Menu {
                  title: qsTr ("Sub Menu 2")
                  MenuItem {
                      text: "Sub Menu 2 Item"
                  }
              }
          }
      }
      

      On Linux (Debian) all work fine, but there are no sub menus on Windows.
      Looking to the code I've found QWidget backend is used on Windows. But QWidget backend don't implement sub menus.
      I use QtQuick 2 only and has no lot of expierence in QtWidgets, but seems it should work (see Qt Widgets Menu Example)

        Attachments

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

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            ssolomin Solomin Sergey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes