Convert all ScrollViews to Controls2

This was a bit of a doozy. One was really simple but the other one had me stumped for a while: The Controls2 version doesn't have the viewport property any more, so just use the width.

Contributes to issue CURA-8686.
This commit is contained in:
Ghostkeeper 2022-01-19 13:48:21 +01:00
parent 4d9039288b
commit 509c9068eb
No known key found for this signature in database
GPG Key ID: D2A8871EE34EC59A

View File

@ -1,16 +1,17 @@
// Copyright (c) 2017 Ultimaker B.V.
// Copyright (c) 2022 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls 2.15
import QtQuick.Controls 1.4 as OldControls
import QtQuick.Dialogs 1.2
import UM 1.2 as UM
import UM 1.5 as UM
import Cura 1.0 as Cura
import ".." // Access to ReadOnlyTextArea.qml
TabView
OldControls.TabView
{
id: base
@ -67,7 +68,7 @@ TabView
}
}
Tab
OldControls.Tab
{
title: catalog.i18nc("@title", "Information")
@ -77,11 +78,21 @@ TabView
{
id: scrollView
anchors.fill: parent
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
flickableItem.flickableDirection: Flickable.VerticalFlick
frameVisible: true
property real columnWidth: (viewport.width * 0.5 - UM.Theme.getSize("default_margin").width) | 0
ScrollBar.vertical: UM.ScrollBar
{
parent: scrollView
anchors
{
top: parent.top
right: parent.right
bottom: parent.bottom
}
}
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
clip: true
property real columnWidth: (scrollView.width * 0.5 - UM.Theme.getSize("default_margin").width) | 0
Flow
{
@ -257,7 +268,7 @@ TabView
}
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament Cost") }
SpinBox
OldControls.SpinBox
{
id: spoolCostSpinBox
width: scrollView.columnWidth
@ -274,7 +285,7 @@ TabView
}
Label { width: scrollView.columnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament weight") }
SpinBox
OldControls.SpinBox
{
id: spoolWeightSpinBox
width: scrollView.columnWidth
@ -318,7 +329,7 @@ TabView
wrapMode: Text.WordWrap
visible: unlinkMaterialButton.visible
}
Button
OldControls.Button
{
id: unlinkMaterialButton
text: catalog.i18nc("@label", "Unlink Material")
@ -369,7 +380,7 @@ TabView
}
}
Tab
OldControls.Tab
{
title: catalog.i18nc("@label", "Print settings")
anchors
@ -380,12 +391,9 @@ TabView
rightMargin: 0
}
ScrollView
{
anchors.fill: parent;
ListView
{
anchors.fill: parent
model: UM.SettingDefinitionsModel
{
containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: ""
@ -393,6 +401,9 @@ TabView
expanded: ["*"]
}
ScrollBar.vertical: UM.ScrollBar {}
clip: true
delegate: UM.TooltipArea
{
width: childrenRect.width
@ -463,7 +474,6 @@ TabView
}
}
}
}
function calculateSpoolLength(diameter, density, spoolWeight)
{