mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-11 16:19:05 +08:00
Add rounded corners to stage menus
CURA-5785
This commit is contained in:
parent
20e2f317de
commit
b83175a380
@ -23,7 +23,7 @@ Item
|
|||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
width: openFileButton.width + UM.Theme.getSize("default_margin").width + itemRow.width
|
width: openFileButton.width + itemRowBackground.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
||||||
Button
|
Button
|
||||||
@ -36,45 +36,59 @@ Item
|
|||||||
action: Cura.Actions.open
|
action: Cura.Actions.open
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout
|
Rectangle
|
||||||
{
|
{
|
||||||
id: itemRow
|
id: itemRowBackground
|
||||||
|
radius: UM.Theme.getSize("default_radius").width
|
||||||
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
|
border.color: UM.Theme.getColor("lining")
|
||||||
|
color: UM.Theme.getColor("toolbar_background")
|
||||||
|
|
||||||
|
width: itemRow.width + UM.Theme.getSize("default_margin").width
|
||||||
|
height: parent.height
|
||||||
|
|
||||||
anchors.left: openFileButton.right
|
anchors.left: openFileButton.right
|
||||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
width: 0.9 * prepareMenu.width
|
RowLayout
|
||||||
height: parent.height
|
|
||||||
|
|
||||||
Cura.MachineSelector
|
|
||||||
{
|
{
|
||||||
id: machineSelection
|
id: itemRow
|
||||||
z: openFileButton.z - 1
|
|
||||||
|
|
||||||
Layout.minimumWidth: 240
|
anchors.centerIn: parent
|
||||||
Layout.maximumWidth: 240
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Cura.QuickConfigurationSelector
|
width: 0.9 * prepareMenu.width
|
||||||
{
|
height: parent.height - 2 * UM.Theme.getSize("default_lining").width
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelector.width
|
|
||||||
}
|
|
||||||
|
|
||||||
Cura.PrintSetupSelector
|
Cura.MachineSelector
|
||||||
{
|
{
|
||||||
id: printSetupSelector
|
id: machineSelection
|
||||||
|
z: openFileButton.z - 1
|
||||||
|
|
||||||
onShowTooltip: prepareMenu.showTooltip(item, location, text)
|
Layout.minimumWidth: 240
|
||||||
onHideTooltip: prepareMenu.hideTooltip()
|
Layout.maximumWidth: 240
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
}
|
||||||
|
|
||||||
Layout.minimumWidth: 460
|
Cura.QuickConfigurationSelector
|
||||||
Layout.maximumWidth: 460
|
{
|
||||||
Layout.fillWidth: true
|
Layout.fillHeight: true
|
||||||
Layout.fillHeight: true
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelector.width
|
||||||
|
}
|
||||||
|
|
||||||
|
Cura.PrintSetupSelector
|
||||||
|
{
|
||||||
|
id: printSetupSelector
|
||||||
|
|
||||||
|
onShowTooltip: prepareMenu.showTooltip(item, location, text)
|
||||||
|
onHideTooltip: prepareMenu.hideTooltip()
|
||||||
|
|
||||||
|
Layout.minimumWidth: 460
|
||||||
|
Layout.maximumWidth: 460
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,88 +15,106 @@ Item
|
|||||||
signal showTooltip(Item item, point location, string text)
|
signal showTooltip(Item item, point location, string text)
|
||||||
signal hideTooltip()
|
signal hideTooltip()
|
||||||
|
|
||||||
|
property real itemHeight: height - 2 * UM.Theme.getSize("default_lining").width
|
||||||
|
|
||||||
UM.I18nCatalog
|
UM.I18nCatalog
|
||||||
{
|
{
|
||||||
id: catalog
|
id: catalog
|
||||||
name: "cura"
|
name: "cura"
|
||||||
}
|
}
|
||||||
|
|
||||||
Row
|
Rectangle
|
||||||
{
|
{
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.fill: stageMenu
|
||||||
spacing: UM.Theme.getSize("default_margin").width
|
anchors.leftMargin: -radius
|
||||||
|
radius: UM.Theme.getSize("default_radius").width
|
||||||
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
|
border.color: UM.Theme.getColor("lining")
|
||||||
|
color: UM.Theme.getColor("toolbar_background")
|
||||||
|
}
|
||||||
|
|
||||||
|
Item
|
||||||
|
{
|
||||||
|
id: stageMenu
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
width: childrenRect.width + UM.Theme.getSize("default_margin").width
|
||||||
Rectangle
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
Row
|
||||||
{
|
{
|
||||||
color: UM.Theme.getColor("tool_panel_background")
|
anchors.centerIn: parent
|
||||||
width: viewModeButton.width + 2 * UM.Theme.getSize("default_margin").width
|
spacing: UM.Theme.getSize("default_margin").width
|
||||||
height: parent.height
|
height: parent.height - 2 * UM.Theme.getSize("default_lining").width
|
||||||
ComboBox
|
|
||||||
|
Item
|
||||||
{
|
{
|
||||||
// This item contains the views selector, a combobox that is dynamically created from
|
width: viewModeButton.width + 2 * UM.Theme.getSize("default_margin").width
|
||||||
// the list of available Views (packages that create different visualizations of the
|
height: parent.height
|
||||||
// scene).
|
ComboBox
|
||||||
id: viewModeButton
|
|
||||||
|
|
||||||
style: UM.Theme.styles.combobox
|
|
||||||
anchors.centerIn: parent
|
|
||||||
model: UM.ViewModel { }
|
|
||||||
textRole: "name"
|
|
||||||
|
|
||||||
// update the model's active index
|
|
||||||
function updateItemActiveFlags()
|
|
||||||
{
|
{
|
||||||
currentIndex = getActiveIndex()
|
// This item contains the views selector, a combobox that is dynamically created from
|
||||||
for (var i = 0; i < model.rowCount(); i++)
|
// the list of available Views (packages that create different visualizations of the
|
||||||
{
|
// scene).
|
||||||
model.getItem(i).active = (i == currentIndex)
|
id: viewModeButton
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the index of the active model item on start
|
style: UM.Theme.styles.combobox
|
||||||
function getActiveIndex()
|
anchors.centerIn: parent
|
||||||
{
|
model: UM.ViewModel { }
|
||||||
for (var i = 0; i < model.rowCount(); i++)
|
textRole: "name"
|
||||||
|
|
||||||
|
// update the model's active index
|
||||||
|
function updateItemActiveFlags()
|
||||||
{
|
{
|
||||||
if (model.getItem(i).active)
|
currentIndex = getActiveIndex()
|
||||||
|
for (var i = 0; i < model.rowCount(); i++)
|
||||||
{
|
{
|
||||||
return i;
|
model.getItem(i).active = (i == currentIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
onCurrentIndexChanged:
|
// get the index of the active model item on start
|
||||||
{
|
function getActiveIndex()
|
||||||
if (model.getItem(currentIndex).id != undefined)
|
|
||||||
{
|
{
|
||||||
UM.Controller.setActiveView(model.getItem(currentIndex).id)
|
for (var i = 0; i < model.rowCount(); i++)
|
||||||
|
{
|
||||||
|
if (model.getItem(i).active)
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onCurrentIndexChanged:
|
||||||
|
{
|
||||||
|
if (model.getItem(currentIndex).id != undefined)
|
||||||
|
{
|
||||||
|
UM.Controller.setActiveView(model.getItem(currentIndex).id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
currentIndex: getActiveIndex()
|
||||||
}
|
}
|
||||||
currentIndex: getActiveIndex()
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Loader
|
Loader
|
||||||
{
|
{
|
||||||
// TODO: Make this panel collapsable and ensure it has a standardised background.
|
// TODO: Make this panel collapsable and ensure it has a standardised background.
|
||||||
id: viewPanel
|
id: viewPanel
|
||||||
|
|
||||||
property var buttonTarget: Qt.point(viewModeButton.x + Math.round(viewModeButton.width / 2), viewModeButton.y + Math.round(viewModeButton.height / 2))
|
property var buttonTarget: Qt.point(viewModeButton.x + Math.round(viewModeButton.width / 2), viewModeButton.y + Math.round(viewModeButton.height / 2))
|
||||||
|
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: childrenRect.width
|
width: childrenRect.width
|
||||||
|
|
||||||
source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : ""
|
source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : ""
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.PrintSetupSelector
|
Cura.PrintSetupSelector
|
||||||
{
|
{
|
||||||
width: UM.Theme.getSize("print_setup_widget").width
|
width: UM.Theme.getSize("print_setup_widget").width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
onShowTooltip: previewMenu.showTooltip(item, location, text)
|
onShowTooltip: previewMenu.showTooltip(item, location, text)
|
||||||
onHideTooltip: previewMenu.hideTooltip()
|
onHideTooltip: previewMenu.hideTooltip()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user