Changeset View
Changeset View
Standalone View
Standalone View
src/controls/private/ActionsMenu.qml
Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Line(s) | 60 | else { | |||
---|---|---|---|---|---|
61 | item = theMenu.itemDelegate.createObject(null, { ourAction: action }); | 61 | item = theMenu.itemDelegate.createObject(null, { ourAction: action }); | ||
62 | } | 62 | } | ||
63 | theMenu.addItem(item) | 63 | theMenu.addItem(item) | ||
64 | } else if (theMenu.submenuComponent) { | 64 | } else if (theMenu.submenuComponent) { | ||
65 | item = theMenu.submenuComponent.createObject(null, { parentAction: action, title: action.text, actions: action.children }); | 65 | item = theMenu.submenuComponent.createObject(null, { parentAction: action, title: action.text, actions: action.children }); | ||
66 | 66 | | |||
67 | theMenu.insertMenu(theMenu.count, item) | 67 | theMenu.insertMenu(theMenu.count, item) | ||
68 | item.parentItem = theMenu.contentData[theMenu.contentData.length-1] | 68 | item.parentItem = theMenu.contentData[theMenu.contentData.length-1] | ||
69 | item.parentItem.icon = action.icon | ||||
69 | } | 70 | } | ||
70 | } | 71 | } | ||
71 | function remove() { | 72 | function remove() { | ||
72 | if (!action.hasOwnProperty("children") && !action.children || action.children.length === 0) { | 73 | if (!action.hasOwnProperty("children") && !action.children || action.children.length === 0) { | ||
73 | theMenu.removeItem(item) | 74 | theMenu.removeItem(item) | ||
74 | } else if (theMenu.submenuComponent) { | 75 | } else if (theMenu.submenuComponent) { | ||
75 | theMenu.removeMenu(item) | 76 | theMenu.removeMenu(item) | ||
76 | } | 77 | } | ||
77 | } | 78 | } | ||
78 | } | 79 | } | ||
79 | 80 | | |||
80 | onObjectAdded: object.create() | 81 | onObjectAdded: object.create() | ||
81 | onObjectRemoved: object.remove() | 82 | onObjectRemoved: object.remove() | ||
82 | } | 83 | } | ||
83 | } | 84 | } |