Replace ScrollView+Column+Repeater by ListView with correct scrollbar

Much simpler. And looks more consistent too.

Contributes to issue CURA-8686.
This commit is contained in:
Ghostkeeper 2022-01-19 14:58:55 +01:00
parent 5041162a99
commit f94b7ce753
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -1,11 +1,11 @@
// Copyright (c) 2019 Ultimaker B.V. // Copyright (c) 2022 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import UM 1.3 as UM import UM 1.5 as UM
import Cura 1.7 as Cura import Cura 1.7 as Cura
@ -22,7 +22,7 @@ Item
property bool searchingForCloudPrinters: true property bool searchingForCloudPrinters: true
property var discoveredCloudPrintersModel: CuraApplication.getDiscoveredCloudPrintersModel() property var discoveredCloudPrintersModel: CuraApplication.getDiscoveredCloudPrintersModel()
// The area where either the discoveredCloudPrintersScrollView or the busyIndicator will be displayed // The area where either the discoveredCloudPrintersList or the busyIndicator will be displayed
Item Item
{ {
id: cloudPrintersContent id: cloudPrintersContent
@ -126,14 +126,9 @@ Item
// The scrollView that contains the list of newly discovered Ultimaker Cloud printers. Visible only when // The scrollView that contains the list of newly discovered Ultimaker Cloud printers. Visible only when
// there is at least a new cloud printer. // there is at least a new cloud printer.
ScrollView ListView
{ {
id: discoveredCloudPrintersScrollView id: discoveredCloudPrintersList
width: parent.width
clip : true
ScrollBar.horizontal.policy: ScrollBar.AsNeeded
ScrollBar.vertical.policy: ScrollBar.AsNeeded
visible: discoveredCloudPrintersModel.count > 0
anchors anchors
{ {
top: cloudPrintersAddedTitle.bottom top: cloudPrintersAddedTitle.bottom
@ -144,18 +139,15 @@ Item
bottom: parent.bottom bottom: parent.bottom
} }
Column ScrollBar.vertical: UM.ScrollBar {}
{ clip : true
id: discoveredPrintersColumn visible: discoveredCloudPrintersModel.count > 0
spacing: 2 * UM.Theme.getSize("default_margin").height spacing: UM.Theme.getSize("wide_margin").height
Repeater
{
id: discoveredCloudPrintersRepeater
model: discoveredCloudPrintersModel model: discoveredCloudPrintersModel
delegate: Item delegate: Item
{ {
width: discoveredCloudPrintersScrollView.width width: discoveredCloudPrintersList.width
height: contentColumn.height height: contentColumn.height
Column Column
@ -193,8 +185,6 @@ Item
} }
} }
} }
}
}
Cura.SecondaryButton Cura.SecondaryButton
{ {