mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 17:55:52 +08:00
Add scrollview to material list
CURA-6867
This commit is contained in:
parent
7174861bba
commit
d4679515b6
@ -244,6 +244,8 @@ Cura.MenuItem
|
||||
height: materialColorsList.height + padding * 2
|
||||
onOpened:
|
||||
{
|
||||
// This will be resolved before opening the popup if directly assigned to the properties
|
||||
// This forces these values to update whenever a popup is opened
|
||||
var popupHeight = model.colors.count * UM.Theme.getSize("menu").height
|
||||
var parentGlobalY = parent.mapToItem(null, 0, 0).y
|
||||
var overflowY = (parentGlobalY + popupHeight) - mainWindow.height
|
||||
@ -252,6 +254,10 @@ Cura.MenuItem
|
||||
var parentGlobalX = materialTypesList.mapToItem(null, 0, 0).x
|
||||
var overflowX = (parentGlobalX + parent.width + colorPopup.width) - mainWindow.width
|
||||
x = overflowX > 0 ? parent.width - overflowX : parent.width
|
||||
|
||||
var popupHeight = model.colors.count * UM.Theme.getSize("menu").height
|
||||
scrollView.height = popupHeight > mainWindow.height ? mainWindow.height: popupHeight
|
||||
colorPopup.height = popupHeight > mainWindow.height ? mainWindow.height: popupHeight
|
||||
}
|
||||
|
||||
property int itemHovered: 0
|
||||
@ -263,11 +269,27 @@ Cura.MenuItem
|
||||
border.color: UM.Theme.getColor("lining")
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
}
|
||||
ScrollView
|
||||
{
|
||||
id: scrollView
|
||||
width: UM.Theme.getSize("menu").width + scrollbar.width
|
||||
height: parent.height
|
||||
clip: true
|
||||
|
||||
ScrollBar.vertical: UM.ScrollBar
|
||||
{
|
||||
id: scrollbar
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
|
||||
Column
|
||||
{
|
||||
id: materialColorsList
|
||||
property var brandColors: model.colors
|
||||
width: UM.Theme.getSize("menu").width
|
||||
height: parent.height
|
||||
spacing: 0
|
||||
|
||||
Repeater
|
||||
@ -277,12 +299,14 @@ Cura.MenuItem
|
||||
delegate: Rectangle
|
||||
{
|
||||
height: UM.Theme.getSize("menu").height
|
||||
width: UM.Theme.getSize("menu").width
|
||||
width: parent.width
|
||||
|
||||
color: materialColorButton.containsMouse ? UM.Theme.getColor("background_2") : UM.Theme.getColor("background_1")
|
||||
// color: materialColorButton.containsMouse ? UM.Theme.getColor("background_2") : UM.Theme.getColor("background_1")
|
||||
|
||||
Item
|
||||
Rectangle
|
||||
{
|
||||
height: parent.height
|
||||
width: parent.width
|
||||
opacity: materialBrandMenu.enabled ? 1 : 0.5
|
||||
anchors.fill: parent
|
||||
|
||||
@ -346,4 +370,5 @@ Cura.MenuItem
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user