mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-30 15:54:32 +08:00

It seems that the extra logic doesn't play well with a menu bar. Since we don't need to make this menu invisible ever, there is no need for the extra logic to hide it. As such we can just use the regular menu CURA-8683
64 lines
1.5 KiB
QML
64 lines
1.5 KiB
QML
// Copyright (c) 2022 Ultimaker B.V.
|
|
// Cura is released under the terms of the LGPLv3 or higher.
|
|
|
|
import QtQuick 2.7
|
|
import QtQuick.Controls 2.4
|
|
|
|
import UM 1.5 as UM
|
|
import Cura 1.0 as Cura
|
|
|
|
Menu
|
|
{
|
|
id: extensionMenu
|
|
title: catalog.i18nc("@title:menu menubar:toplevel", "E&xtensions")
|
|
|
|
Component
|
|
{
|
|
id: extensionsMenuItem
|
|
|
|
UM.MenuItem
|
|
{
|
|
text: modelText
|
|
onTriggered: extensionsModel.subMenuTriggered(extensionName, modelText)
|
|
}
|
|
}
|
|
|
|
Component
|
|
{
|
|
id: extensionsMenuSeparator
|
|
|
|
MenuSeparator {}
|
|
}
|
|
|
|
Instantiator
|
|
{
|
|
id: extensions
|
|
model: UM.ExtensionModel { }
|
|
|
|
UM.Menu
|
|
{
|
|
id: sub_menu
|
|
title: model.name
|
|
shouldBeVisible: actions !== undefined
|
|
enabled: actions != null
|
|
Instantiator
|
|
{
|
|
model: actions
|
|
Loader
|
|
{
|
|
property var extensionsModel: extensions.model
|
|
property var modelText: model.text
|
|
property var extensionName: name
|
|
|
|
sourceComponent: modelText.trim() == "" ? extensionsMenuSeparator : extensionsMenuItem
|
|
}
|
|
|
|
onObjectAdded: sub_menu.insertItem(index, object.item)
|
|
onObjectRemoved: sub_menu.removeItem(object.item)
|
|
}
|
|
}
|
|
|
|
onObjectAdded: extensionMenu.insertMenu(index, object)
|
|
onObjectRemoved: extensionMenu.removeMenu(object)
|
|
}
|
|
} |