mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 17:15:56 +08:00
Use new ListView instead of ScrollView, with correct scrollbar
I also fixed an undefined reference for whether a button needed to be enabled, if no profile was selected yet. The button was invisible if it was undefined, but it was still giving QML warnings. Contributes to issue CURA-8686.
This commit is contained in:
parent
7a1578cbc4
commit
4614b3a9e1
@ -1,12 +1,13 @@
|
|||||||
// Copyright (c) 2019 Ultimaker B.V.
|
// Copyright (c) 2022 Ultimaker B.V.
|
||||||
// Uranium is released under the terms of the LGPLv3 or higher.
|
// Uranium is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 2.15
|
||||||
|
import QtQuick.Controls 1.4 as OldControls
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import QtQuick.Dialogs 1.2
|
import QtQuick.Dialogs 1.2
|
||||||
|
|
||||||
import UM 1.2 as UM
|
import UM 1.5 as UM
|
||||||
import Cura 1.6 as Cura
|
import Cura 1.6 as Cura
|
||||||
|
|
||||||
|
|
||||||
@ -78,7 +79,7 @@ Item
|
|||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
|
|
||||||
// Activate button
|
// Activate button
|
||||||
Button
|
OldControls.Button
|
||||||
{
|
{
|
||||||
id: activateMenuButton
|
id: activateMenuButton
|
||||||
text: catalog.i18nc("@action:button", "Activate")
|
text: catalog.i18nc("@action:button", "Activate")
|
||||||
@ -98,7 +99,7 @@ Item
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create button
|
// Create button
|
||||||
Button
|
OldControls.Button
|
||||||
{
|
{
|
||||||
id: createMenuButton
|
id: createMenuButton
|
||||||
text: catalog.i18nc("@label", "Create")
|
text: catalog.i18nc("@label", "Create")
|
||||||
@ -115,7 +116,7 @@ Item
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Duplicate button
|
// Duplicate button
|
||||||
Button
|
OldControls.Button
|
||||||
{
|
{
|
||||||
id: duplicateMenuButton
|
id: duplicateMenuButton
|
||||||
text: catalog.i18nc("@label", "Duplicate")
|
text: catalog.i18nc("@label", "Duplicate")
|
||||||
@ -132,7 +133,7 @@ Item
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove button
|
// Remove button
|
||||||
Button
|
OldControls.Button
|
||||||
{
|
{
|
||||||
id: removeMenuButton
|
id: removeMenuButton
|
||||||
text: catalog.i18nc("@action:button", "Remove")
|
text: catalog.i18nc("@action:button", "Remove")
|
||||||
@ -146,7 +147,7 @@ Item
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Rename button
|
// Rename button
|
||||||
Button
|
OldControls.Button
|
||||||
{
|
{
|
||||||
id: renameMenuButton
|
id: renameMenuButton
|
||||||
text: catalog.i18nc("@action:button", "Rename")
|
text: catalog.i18nc("@action:button", "Rename")
|
||||||
@ -161,7 +162,7 @@ Item
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Import button
|
// Import button
|
||||||
Button
|
OldControls.Button
|
||||||
{
|
{
|
||||||
id: importMenuButton
|
id: importMenuButton
|
||||||
text: catalog.i18nc("@action:button", "Import")
|
text: catalog.i18nc("@action:button", "Import")
|
||||||
@ -173,7 +174,7 @@ Item
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Export button
|
// Export button
|
||||||
Button
|
OldControls.Button
|
||||||
{
|
{
|
||||||
id: exportMenuButton
|
id: exportMenuButton
|
||||||
text: catalog.i18nc("@action:button", "Export")
|
text: catalog.i18nc("@action:button", "Export")
|
||||||
@ -397,13 +398,13 @@ Item
|
|||||||
}
|
}
|
||||||
visible: text != ""
|
visible: text != ""
|
||||||
text: catalog.i18nc("@label %1 is printer name", "Printer: %1").arg(Cura.MachineManager.activeMachine.name)
|
text: catalog.i18nc("@label %1 is printer name", "Printer: %1").arg(Cura.MachineManager.activeMachine.name)
|
||||||
width: profileScrollView.width
|
width: profileBackground.width
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView
|
Rectangle
|
||||||
{
|
{
|
||||||
id: profileScrollView
|
id: profileBackground
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
top: captionLabel.visible ? captionLabel.bottom : parent.top
|
top: captionLabel.visible ? captionLabel.bottom : parent.top
|
||||||
@ -411,22 +412,20 @@ Item
|
|||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
|
width: (parent.width * 0.4) | 0
|
||||||
|
|
||||||
Rectangle
|
|
||||||
{
|
|
||||||
parent: viewport
|
|
||||||
anchors.fill: parent
|
|
||||||
color: palette.light
|
color: palette.light
|
||||||
}
|
|
||||||
|
|
||||||
width: true ? (parent.width * 0.4) | 0 : parent.width
|
|
||||||
frameVisible: true
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
ListView
|
ListView
|
||||||
{
|
{
|
||||||
id: qualityListView
|
id: qualityListView
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
ScrollBar.vertical: UM.ScrollBar
|
||||||
|
{
|
||||||
|
id: profileScrollBar
|
||||||
|
}
|
||||||
|
clip: true
|
||||||
model: base.qualityManagementModel
|
model: base.qualityManagementModel
|
||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
@ -461,7 +460,7 @@ Item
|
|||||||
|
|
||||||
delegate: Rectangle
|
delegate: Rectangle
|
||||||
{
|
{
|
||||||
width: profileScrollView.width
|
width: profileBackground.width - profileScrollBar.width
|
||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
|
|
||||||
// Added this property to identify custom profiles in automated system tests (Squish)
|
// Added this property to identify custom profiles in automated system tests (Squish)
|
||||||
@ -513,7 +512,7 @@ Item
|
|||||||
|
|
||||||
anchors
|
anchors
|
||||||
{
|
{
|
||||||
left: profileScrollView.right
|
left: profileBackground.right
|
||||||
leftMargin: UM.Theme.getSize("default_margin").width
|
leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
top: parent.top
|
top: parent.top
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
@ -555,7 +554,7 @@ Item
|
|||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@action:button", "Update profile with current settings/overrides")
|
text: catalog.i18nc("@action:button", "Update profile with current settings/overrides")
|
||||||
enabled: Cura.MachineManager.hasUserSettings && !base.currentItem.is_read_only
|
enabled: Cura.MachineManager.hasUserSettings && qualityListView.currentItem && !qualityListView.currentItem.is_read_only
|
||||||
onClicked: Cura.ContainerManager.updateQualityChanges()
|
onClicked: Cura.ContainerManager.updateQualityChanges()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,7 +593,7 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TabView
|
OldControls.TabView
|
||||||
{
|
{
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.top: profileNotices.visible ? profileNotices.bottom : profileNotices.anchors.top
|
anchors.top: profileNotices.visible ? profileNotices.bottom : profileNotices.anchors.top
|
||||||
|
Loading…
x
Reference in New Issue
Block a user