Use Cura's own ComboBox element for combo boxes

This one displays a tooltip if the text is too long and gets elided, so that you can still read the printer or profile name.

Fixes #8773.
This commit is contained in:
Ghostkeeper 2020-11-17 10:56:12 +01:00
parent 29258aa5e2
commit 558a789289
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -1,4 +1,4 @@
// Copyright (c) 2016 Ultimaker B.V. // Copyright (c) 2020 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
@ -7,6 +7,7 @@ import QtQuick.Layouts 1.3
import QtQuick.Window 2.2 import QtQuick.Window 2.2
import UM 1.1 as UM import UM 1.1 as UM
import Cura 1.1 as Cura
UM.Dialog UM.Dialog
{ {
@ -110,13 +111,14 @@ UM.Dialog
height: visible ? comboboxHeight : 0 height: visible ? comboboxHeight : 0
visible: base.visible && machineResolveComboBox.model.count > 1 visible: base.visible && machineResolveComboBox.model.count > 1
text: catalog.i18nc("@info:tooltip", "How should the conflict in the machine be resolved?") text: catalog.i18nc("@info:tooltip", "How should the conflict in the machine be resolved?")
ComboBox Cura.ComboBox
{ {
id: machineResolveComboBox id: machineResolveComboBox
model: manager.updatableMachinesModel model: manager.updatableMachinesModel
visible: machineResolveStrategyTooltip.visible visible: machineResolveStrategyTooltip.visible
textRole: "displayName" textRole: "displayName"
width: parent.width width: parent.width
height: UM.Theme.getSize("button").height
onCurrentIndexChanged: onCurrentIndexChanged:
{ {
if (model.getItem(currentIndex).id == "new" if (model.getItem(currentIndex).id == "new"
@ -217,12 +219,13 @@ UM.Dialog
height: visible ? comboboxHeight : 0 height: visible ? comboboxHeight : 0
visible: manager.qualityChangesConflict visible: manager.qualityChangesConflict
text: catalog.i18nc("@info:tooltip", "How should the conflict in the profile be resolved?") text: catalog.i18nc("@info:tooltip", "How should the conflict in the profile be resolved?")
ComboBox Cura.ComboBox
{ {
model: resolveStrategiesModel model: resolveStrategiesModel
textRole: "label" textRole: "label"
id: qualityChangesResolveComboBox id: qualityChangesResolveComboBox
width: parent.width width: parent.width
height: UM.Theme.getSize("button").height
onActivated: onActivated:
{ {
manager.setResolveStrategy("quality_changes", resolveStrategiesModel.get(index).key) manager.setResolveStrategy("quality_changes", resolveStrategiesModel.get(index).key)
@ -323,12 +326,13 @@ UM.Dialog
height: visible ? comboboxHeight : 0 height: visible ? comboboxHeight : 0
visible: manager.materialConflict visible: manager.materialConflict
text: catalog.i18nc("@info:tooltip", "How should the conflict in the material be resolved?") text: catalog.i18nc("@info:tooltip", "How should the conflict in the material be resolved?")
ComboBox Cura.ComboBox
{ {
model: resolveStrategiesModel model: resolveStrategiesModel
textRole: "label" textRole: "label"
id: materialResolveComboBox id: materialResolveComboBox
width: parent.width width: parent.width
height: UM.Theme.getSize("button").height
onActivated: onActivated:
{ {
manager.setResolveStrategy("material", resolveStrategiesModel.get(index).key) manager.setResolveStrategy("material", resolveStrategiesModel.get(index).key)