mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 22:45:53 +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
|
height: materialColorsList.height + padding * 2
|
||||||
onOpened:
|
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 popupHeight = model.colors.count * UM.Theme.getSize("menu").height
|
||||||
var parentGlobalY = parent.mapToItem(null, 0, 0).y
|
var parentGlobalY = parent.mapToItem(null, 0, 0).y
|
||||||
var overflowY = (parentGlobalY + popupHeight) - mainWindow.height
|
var overflowY = (parentGlobalY + popupHeight) - mainWindow.height
|
||||||
@ -252,6 +254,10 @@ Cura.MenuItem
|
|||||||
var parentGlobalX = materialTypesList.mapToItem(null, 0, 0).x
|
var parentGlobalX = materialTypesList.mapToItem(null, 0, 0).x
|
||||||
var overflowX = (parentGlobalX + parent.width + colorPopup.width) - mainWindow.width
|
var overflowX = (parentGlobalX + parent.width + colorPopup.width) - mainWindow.width
|
||||||
x = overflowX > 0 ? parent.width - overflowX : parent.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
|
property int itemHovered: 0
|
||||||
@ -263,11 +269,27 @@ Cura.MenuItem
|
|||||||
border.color: UM.Theme.getColor("lining")
|
border.color: UM.Theme.getColor("lining")
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
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
|
Column
|
||||||
{
|
{
|
||||||
id: materialColorsList
|
id: materialColorsList
|
||||||
property var brandColors: model.colors
|
property var brandColors: model.colors
|
||||||
|
width: UM.Theme.getSize("menu").width
|
||||||
|
height: parent.height
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
Repeater
|
Repeater
|
||||||
@ -277,12 +299,14 @@ Cura.MenuItem
|
|||||||
delegate: Rectangle
|
delegate: Rectangle
|
||||||
{
|
{
|
||||||
height: UM.Theme.getSize("menu").height
|
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
|
opacity: materialBrandMenu.enabled ? 1 : 0.5
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
@ -346,4 +370,5 @@ Cura.MenuItem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user