|
@@ -78,7 +78,7 @@ Item
|
|
|
id: contents
|
|
|
width: parent.width
|
|
|
visible: objectSelector.opened
|
|
|
- height: visible ? scroll.height : 0
|
|
|
+ height: visible ? listView.height : 0
|
|
|
color: UM.Theme.getColor("main_background")
|
|
|
border.width: UM.Theme.getSize("default_lining").width
|
|
|
border.color: UM.Theme.getColor("lining")
|
|
@@ -87,50 +87,39 @@ Item
|
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
|
- ScrollView
|
|
|
+ ListView
|
|
|
{
|
|
|
- id: scroll
|
|
|
- width: parent.width
|
|
|
+ id: listView
|
|
|
clip: true
|
|
|
- padding: UM.Theme.getSize("default_lining").width
|
|
|
+ anchors
|
|
|
+ {
|
|
|
+ left: parent.left
|
|
|
+ right: parent.right
|
|
|
+ margins: UM.Theme.getSize("default_lining").width
|
|
|
+ }
|
|
|
|
|
|
- contentItem: ListView
|
|
|
+ ScrollBar.vertical: ScrollBar
|
|
|
{
|
|
|
- id: listView
|
|
|
+ hoverEnabled: true
|
|
|
+ }
|
|
|
|
|
|
- // Can't use parent.width since the parent is the flickable component and not the ScrollView
|
|
|
- width: scroll.width - scroll.leftPadding - scroll.rightPadding
|
|
|
- property real maximumHeight: UM.Theme.getSize("objects_menu_size").height
|
|
|
+ property real maximumHeight: UM.Theme.getSize("objects_menu_size").height
|
|
|
|
|
|
- // We use an extra property here, since we only want to to be informed about the content size changes.
|
|
|
- onContentHeightChanged:
|
|
|
- {
|
|
|
- // It can sometimes happen that (due to animations / updates) the contentHeight is -1.
|
|
|
- // This can cause a bunch of updates to trigger oneother, leading to a weird loop.
|
|
|
- if(contentHeight >= 0)
|
|
|
- {
|
|
|
- scroll.height = Math.min(contentHeight, maximumHeight) + scroll.topPadding + scroll.bottomPadding
|
|
|
- }
|
|
|
- }
|
|
|
+ height: Math.min(contentHeight, maximumHeight)
|
|
|
|
|
|
- Component.onCompleted:
|
|
|
- {
|
|
|
- scroll.height = Math.min(contentHeight, maximumHeight) + scroll.topPadding + scroll.bottomPadding
|
|
|
- }
|
|
|
- model: Cura.ObjectsModel {}
|
|
|
+ model: Cura.ObjectsModel {}
|
|
|
|
|
|
- delegate: ObjectItemButton
|
|
|
+ delegate: ObjectItemButton
|
|
|
+ {
|
|
|
+ id: modelButton
|
|
|
+ Binding
|
|
|
{
|
|
|
- id: modelButton
|
|
|
- Binding
|
|
|
- {
|
|
|
- target: modelButton
|
|
|
- property: "checked"
|
|
|
- value: model.selected
|
|
|
- }
|
|
|
- text: model.name
|
|
|
- width: listView.width
|
|
|
+ target: modelButton
|
|
|
+ property: "checked"
|
|
|
+ value: model.selected
|
|
|
}
|
|
|
+ text: model.name
|
|
|
+ width: listView.width
|
|
|
}
|
|
|
}
|
|
|
}
|