mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Fix height and scrolling of add printer menus
This fixes the irritating scrolling behaviour of the local printer menu, as well as the disappearing items (former issue which had a workaround) and makes it use a styled scroll bar. Contributes to issue CURA-8686.
This commit is contained in:
parent
f94b7ce753
commit
fa2fbb99c7
3 changed files with 68 additions and 102 deletions
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2019 Ultimaker B.V.
|
||||
// Copyright (c) 2022 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.10
|
||||
|
@ -74,29 +74,18 @@ Item
|
|||
Row
|
||||
{
|
||||
id: localPrinterSelectionItem
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
|
||||
// ScrollView + ListView for selecting a local printer to add
|
||||
Cura.ScrollView
|
||||
{
|
||||
id: scrollView
|
||||
|
||||
height: childrenHeight
|
||||
width: Math.floor(parent.width * 0.48)
|
||||
anchors.fill: parent
|
||||
|
||||
//Selecting a local printer to add from this list.
|
||||
ListView
|
||||
{
|
||||
id: machineList
|
||||
width: Math.floor(parent.width * 0.48)
|
||||
height: parent.height
|
||||
|
||||
clip: true
|
||||
ScrollBar.vertical: UM.ScrollBar {}
|
||||
|
||||
// CURA-6793
|
||||
// Enabling the buffer seems to cause the blank items issue. When buffer is enabled, if the ListView's
|
||||
// individual item has a dynamic change on its visibility, the ListView doesn't redraw itself.
|
||||
// The default value of cacheBuffer is platform-dependent, so we explicitly disable it here.
|
||||
cacheBuffer: 0
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
flickDeceleration: 20000 // To prevent the flicking behavior.
|
||||
model: UM.DefinitionContainersModel
|
||||
{
|
||||
id: machineDefinitionsModel
|
||||
|
@ -106,18 +95,10 @@ Item
|
|||
}
|
||||
|
||||
section.property: "section"
|
||||
section.delegate: sectionHeader
|
||||
delegate: machineButton
|
||||
}
|
||||
|
||||
Component
|
||||
{
|
||||
id: sectionHeader
|
||||
|
||||
Button
|
||||
section.delegate: Button
|
||||
{
|
||||
id: button
|
||||
width: ListView.view.width
|
||||
width: machineList.width
|
||||
height: UM.Theme.getSize("action_button").height
|
||||
text: section
|
||||
|
||||
|
@ -162,30 +143,24 @@ Item
|
|||
base.updateCurrentItemUponSectionChange()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component
|
||||
{
|
||||
id: machineButton
|
||||
|
||||
Cura.RadioButton
|
||||
delegate: Cura.RadioButton
|
||||
{
|
||||
id: radioButton
|
||||
anchors
|
||||
{
|
||||
left: parent !== null ? parent.left: undefined
|
||||
left: parent !== null ? parent.left : undefined
|
||||
leftMargin: UM.Theme.getSize("standard_list_lineheight").width
|
||||
|
||||
right: parent !== null ? parent.right: undefined
|
||||
right: parent !== null ? parent.right : undefined
|
||||
rightMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
height: visible ? UM.Theme.getSize("standard_list_lineheight").height : 0
|
||||
height: visible ? UM.Theme.getSize("standard_list_lineheight").height : 0 //This causes the scrollbar to vary in length due to QTBUG-76830.
|
||||
|
||||
checked: ListView.view.currentIndex == index
|
||||
checked: machineList.currentIndex == index
|
||||
text: name
|
||||
visible: base.currentSection.toLowerCase() === section.toLowerCase()
|
||||
onClicked: ListView.view.currentIndex = index
|
||||
}
|
||||
onClicked: machineList.currentIndex = index
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +169,7 @@ Item
|
|||
{
|
||||
id: verticalLine
|
||||
anchors.top: parent.top
|
||||
height: childrenHeight - UM.Theme.getSize("default_lining").height
|
||||
height: parent.height - UM.Theme.getSize("default_lining").height
|
||||
width: UM.Theme.getSize("default_lining").height
|
||||
color: UM.Theme.getColor("lining")
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2019 Ultimaker B.V.
|
||||
// Copyright (c) 2022 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.10
|
||||
|
@ -45,11 +45,9 @@ Item
|
|||
}
|
||||
|
||||
contentComponent: networkPrinterListComponent
|
||||
|
||||
Component
|
||||
{
|
||||
id: networkPrinterListComponent
|
||||
|
||||
AddNetworkPrinterScrollView
|
||||
{
|
||||
id: networkPrinterScrollView
|
||||
|
@ -95,20 +93,13 @@ Item
|
|||
}
|
||||
|
||||
contentComponent: localPrinterListComponent
|
||||
|
||||
Component
|
||||
{
|
||||
id: localPrinterListComponent
|
||||
|
||||
AddLocalPrinterScrollView
|
||||
{
|
||||
id: localPrinterView
|
||||
property int childrenHeight: backButton.y - addLocalPrinterDropDown.y - UM.Theme.getSize("expandable_component_content_header").height - UM.Theme.getSize("default_margin").height
|
||||
|
||||
onChildrenHeightChanged:
|
||||
{
|
||||
addLocalPrinterDropDown.children[1].height = childrenHeight
|
||||
}
|
||||
height: backButton.y - addLocalPrinterDropDown.y - UM.Theme.getSize("expandable_component_content_header").height - UM.Theme.getSize("default_margin").height
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2019 Ultimaker B.V.
|
||||
// Copyright (c) 2022 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.10
|
||||
|
@ -61,7 +61,7 @@ Item
|
|||
anchors.left: header.left
|
||||
anchors.right: header.right
|
||||
// Add 2x lining, because it needs a bit of space on the top and the bottom.
|
||||
height: contentLoader.item.height + 2 * UM.Theme.getSize("thick_lining").height
|
||||
height: contentLoader.item ? contentLoader.item.height + 2 * UM.Theme.getSize("thick_lining").height : 0
|
||||
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color: UM.Theme.getColor("lining")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue