Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 0.92 KB | None | 0 0
  1. mport QtQuick 2.5
  2. import QtQuick.Controls 2.13 as QQC2
  3.  
  4. QQC2.Menu {
  5.     id:root
  6.     Repeater {
  7.         Component {
  8.             id: subMenu
  9.             QQC2.Menu  {
  10.                 id: menu
  11.                 title: menuAction.text
  12.                 Repeater{
  13.                     model: menuAction.visibleChildren
  14.                     delegate: QQC2.MenuItem {
  15.                         action: modelData
  16.                     }
  17.                 }
  18.                 Component.onCompleted: {
  19.                     root.addMenu(menu)
  20.                 }
  21.             }
  22.         }
  23.         Component {
  24.             id: menuItem
  25.             QQC2.MenuItem {
  26.                     action: menuAction
  27.                 }
  28.         }
  29.         model: actions.actions
  30.         delegate: Loader {
  31.             property var menuAction: modelData
  32.             sourceComponent: modelData.visibleChildren.length > 0 ? subMenu : menuItem
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement