diff options
author | Remco Burema <r.burema@ultimaker.com> | 2021-12-28 16:54:56 +0300 |
---|---|---|
committer | Remco Burema <r.burema@ultimaker.com> | 2021-12-28 16:54:56 +0300 |
commit | 32b52c6166d90898759177d8fac198d96bc83c8c (patch) | |
tree | abe256121562bae09820dfd96d3bf50b5dc1eee6 /cura/Machines/Models | |
parent | abe7c1bf7f969562d63702e412e671b1e631c178 (diff) |
Qt5->Qt6: Rectify constant locations: UserRole, CppOwnership
part of CURA-8591
Diffstat (limited to 'cura/Machines/Models')
-rw-r--r-- | cura/Machines/Models/BaseMaterialsModel.py | 32 | ||||
-rw-r--r-- | cura/Machines/Models/BuildPlateModel.py | 4 | ||||
-rw-r--r-- | cura/Machines/Models/DiscoveredCloudPrintersModel.py | 8 | ||||
-rw-r--r-- | cura/Machines/Models/ExtrudersModel.py | 26 | ||||
-rw-r--r-- | cura/Machines/Models/FirstStartMachineActionsModel.py | 6 | ||||
-rw-r--r-- | cura/Machines/Models/GlobalStacksModel.py | 16 | ||||
-rw-r--r-- | cura/Machines/Models/IntentCategoryModel.py | 10 | ||||
-rw-r--r-- | cura/Machines/Models/IntentModel.py | 10 | ||||
-rw-r--r-- | cura/Machines/Models/MaterialBrandsModel.py | 10 | ||||
-rw-r--r-- | cura/Machines/Models/NozzleModel.py | 6 | ||||
-rw-r--r-- | cura/Machines/Models/QualityManagementModel.py | 14 | ||||
-rw-r--r-- | cura/Machines/Models/QualityProfilesDropDownMenuModel.py | 16 | ||||
-rw-r--r-- | cura/Machines/Models/QualitySettingsModel.py | 14 | ||||
-rw-r--r-- | cura/Machines/Models/UserChangesModel.py | 12 |
14 files changed, 92 insertions, 92 deletions
diff --git a/cura/Machines/Models/BaseMaterialsModel.py b/cura/Machines/Models/BaseMaterialsModel.py index a32af77094..2521d3686d 100644 --- a/cura/Machines/Models/BaseMaterialsModel.py +++ b/cura/Machines/Models/BaseMaterialsModel.py @@ -61,22 +61,22 @@ class BaseMaterialsModel(ListModel): ContainerTree.getInstance().materialsChanged.connect(self._materialsListChanged) self._application.getMaterialManagementModel().favoritesChanged.connect(self._onChanged) - self.addRoleName(Qt.UserRole + 1, "root_material_id") - self.addRoleName(Qt.UserRole + 2, "id") - self.addRoleName(Qt.UserRole + 3, "GUID") - self.addRoleName(Qt.UserRole + 4, "name") - self.addRoleName(Qt.UserRole + 5, "brand") - self.addRoleName(Qt.UserRole + 6, "description") - self.addRoleName(Qt.UserRole + 7, "material") - self.addRoleName(Qt.UserRole + 8, "color_name") - self.addRoleName(Qt.UserRole + 9, "color_code") - self.addRoleName(Qt.UserRole + 10, "density") - self.addRoleName(Qt.UserRole + 11, "diameter") - self.addRoleName(Qt.UserRole + 12, "approximate_diameter") - self.addRoleName(Qt.UserRole + 13, "adhesion_info") - self.addRoleName(Qt.UserRole + 14, "is_read_only") - self.addRoleName(Qt.UserRole + 15, "container_node") - self.addRoleName(Qt.UserRole + 16, "is_favorite") + self.addRoleName(Qt.ItemDataRole.UserRole + 1, "root_material_id") + self.addRoleName(Qt.ItemDataRole.UserRole + 2, "id") + self.addRoleName(Qt.ItemDataRole.UserRole + 3, "GUID") + self.addRoleName(Qt.ItemDataRole.UserRole + 4, "name") + self.addRoleName(Qt.ItemDataRole.UserRole + 5, "brand") + self.addRoleName(Qt.ItemDataRole.UserRole + 6, "description") + self.addRoleName(Qt.ItemDataRole.UserRole + 7, "material") + self.addRoleName(Qt.ItemDataRole.UserRole + 8, "color_name") + self.addRoleName(Qt.ItemDataRole.UserRole + 9, "color_code") + self.addRoleName(Qt.ItemDataRole.UserRole + 10, "density") + self.addRoleName(Qt.ItemDataRole.UserRole + 11, "diameter") + self.addRoleName(Qt.ItemDataRole.UserRole + 12, "approximate_diameter") + self.addRoleName(Qt.ItemDataRole.UserRole + 13, "adhesion_info") + self.addRoleName(Qt.ItemDataRole.UserRole + 14, "is_read_only") + self.addRoleName(Qt.ItemDataRole.UserRole + 15, "container_node") + self.addRoleName(Qt.ItemDataRole.UserRole + 16, "is_favorite") def _onChanged(self) -> None: self._update_timer.start() diff --git a/cura/Machines/Models/BuildPlateModel.py b/cura/Machines/Models/BuildPlateModel.py index ecceb73f0c..716792ceb6 100644 --- a/cura/Machines/Models/BuildPlateModel.py +++ b/cura/Machines/Models/BuildPlateModel.py @@ -7,8 +7,8 @@ from UM.Qt.ListModel import ListModel class BuildPlateModel(ListModel): - NameRole = Qt.UserRole + 1 - ContainerNodeRole = Qt.UserRole + 2 + NameRole = Qt.ItemDataRole.UserRole + 1 + ContainerNodeRole = Qt.ItemDataRole.UserRole + 2 def __init__(self, parent = None): super().__init__(parent) diff --git a/cura/Machines/Models/DiscoveredCloudPrintersModel.py b/cura/Machines/Models/DiscoveredCloudPrintersModel.py index b9071c9053..c6935b2e34 100644 --- a/cura/Machines/Models/DiscoveredCloudPrintersModel.py +++ b/cura/Machines/Models/DiscoveredCloudPrintersModel.py @@ -12,10 +12,10 @@ class DiscoveredCloudPrintersModel(ListModel): """Model used to inform the application about newly added cloud printers, which are discovered from the user's account """ - DeviceKeyRole = Qt.UserRole + 1 - DeviceNameRole = Qt.UserRole + 2 - DeviceTypeRole = Qt.UserRole + 3 - DeviceFirmwareVersionRole = Qt.UserRole + 4 + DeviceKeyRole = Qt.ItemDataRole.UserRole + 1 + DeviceNameRole = Qt.ItemDataRole.UserRole + 2 + DeviceTypeRole = Qt.ItemDataRole.UserRole + 3 + DeviceFirmwareVersionRole = Qt.ItemDataRole.UserRole + 4 cloudPrintersDetectedChanged = pyqtSignal(bool) diff --git a/cura/Machines/Models/ExtrudersModel.py b/cura/Machines/Models/ExtrudersModel.py index 4f86b139d1..2677894bff 100644 --- a/cura/Machines/Models/ExtrudersModel.py +++ b/cura/Machines/Models/ExtrudersModel.py @@ -23,43 +23,43 @@ class ExtrudersModel(ListModel): """ # The ID of the container stack for the extruder. - IdRole = Qt.UserRole + 1 + IdRole = Qt.ItemDataRole.UserRole + 1 - NameRole = Qt.UserRole + 2 + NameRole = Qt.ItemDataRole.UserRole + 2 """Human-readable name of the extruder.""" - ColorRole = Qt.UserRole + 3 + ColorRole = Qt.ItemDataRole.UserRole + 3 """Colour of the material loaded in the extruder.""" - IndexRole = Qt.UserRole + 4 + IndexRole = Qt.ItemDataRole.UserRole + 4 """Index of the extruder, which is also the value of the setting itself. An index of 0 indicates the first extruder, an index of 1 the second one, and so on. This is the value that will be saved in instance containers. """ # The ID of the definition of the extruder. - DefinitionRole = Qt.UserRole + 5 + DefinitionRole = Qt.ItemDataRole.UserRole + 5 # The material of the extruder. - MaterialRole = Qt.UserRole + 6 + MaterialRole = Qt.ItemDataRole.UserRole + 6 # The variant of the extruder. - VariantRole = Qt.UserRole + 7 - StackRole = Qt.UserRole + 8 + VariantRole = Qt.ItemDataRole.UserRole + 7 + StackRole = Qt.ItemDataRole.UserRole + 8 - MaterialBrandRole = Qt.UserRole + 9 - ColorNameRole = Qt.UserRole + 10 + MaterialBrandRole = Qt.ItemDataRole.UserRole + 9 + ColorNameRole = Qt.ItemDataRole.UserRole + 10 - EnabledRole = Qt.UserRole + 11 + EnabledRole = Qt.ItemDataRole.UserRole + 11 """Is the extruder enabled?""" - MaterialTypeRole = Qt.UserRole + 12 + MaterialTypeRole = Qt.ItemDataRole.UserRole + 12 """The type of the material (e.g. PLA, ABS, PETG, etc.).""" defaultColors = ["#ffc924", "#86ec21", "#22eeee", "#245bff", "#9124ff", "#ff24c8"] """List of colours to display if there is no material or the material has no known colour. """ - MaterialNameRole = Qt.UserRole + 13 + MaterialNameRole = Qt.ItemDataRole.UserRole + 13 def __init__(self, parent = None): """Initialises the extruders model, defining the roles and listening for changes in the data. diff --git a/cura/Machines/Models/FirstStartMachineActionsModel.py b/cura/Machines/Models/FirstStartMachineActionsModel.py index 2b14a74317..b9a1a7cf04 100644 --- a/cura/Machines/Models/FirstStartMachineActionsModel.py +++ b/cura/Machines/Models/FirstStartMachineActionsModel.py @@ -19,9 +19,9 @@ class FirstStartMachineActionsModel(ListModel): - action : the MachineAction object itself """ - TitleRole = Qt.UserRole + 1 - ContentRole = Qt.UserRole + 2 - ActionRole = Qt.UserRole + 3 + TitleRole = Qt.ItemDataRole.UserRole + 1 + ContentRole = Qt.ItemDataRole.UserRole + 2 + ActionRole = Qt.ItemDataRole.UserRole + 3 def __init__(self, application: "CuraApplication", parent: Optional[QObject] = None) -> None: super().__init__(parent) diff --git a/cura/Machines/Models/GlobalStacksModel.py b/cura/Machines/Models/GlobalStacksModel.py index bd1aa50da1..033d89952c 100644 --- a/cura/Machines/Models/GlobalStacksModel.py +++ b/cura/Machines/Models/GlobalStacksModel.py @@ -15,14 +15,14 @@ from cura.UltimakerCloud.UltimakerCloudConstants import META_CAPABILITIES # To class GlobalStacksModel(ListModel): - NameRole = Qt.UserRole + 1 - IdRole = Qt.UserRole + 2 - HasRemoteConnectionRole = Qt.UserRole + 3 - ConnectionTypeRole = Qt.UserRole + 4 - MetaDataRole = Qt.UserRole + 5 - DiscoverySourceRole = Qt.UserRole + 6 # For separating local and remote printers in the machine management page - RemovalWarningRole = Qt.UserRole + 7 - IsOnlineRole = Qt.UserRole + 8 + NameRole = Qt.ItemDataRole.UserRole + 1 + IdRole = Qt.ItemDataRole.UserRole + 2 + HasRemoteConnectionRole = Qt.ItemDataRole.UserRole + 3 + ConnectionTypeRole = Qt.ItemDataRole.UserRole + 4 + MetaDataRole = Qt.ItemDataRole.UserRole + 5 + DiscoverySourceRole = Qt.ItemDataRole.UserRole + 6 # For separating local and remote printers in the machine management page + RemovalWarningRole = Qt.ItemDataRole.UserRole + 7 + IsOnlineRole = Qt.ItemDataRole.UserRole + 8 def __init__(self, parent = None) -> None: super().__init__(parent) diff --git a/cura/Machines/Models/IntentCategoryModel.py b/cura/Machines/Models/IntentCategoryModel.py index c2ae9a0426..14e3c4d35e 100644 --- a/cura/Machines/Models/IntentCategoryModel.py +++ b/cura/Machines/Models/IntentCategoryModel.py @@ -21,11 +21,11 @@ catalog = i18nCatalog("cura") class IntentCategoryModel(ListModel): """Lists the intent categories that are available for the current printer configuration. """ - NameRole = Qt.UserRole + 1 - IntentCategoryRole = Qt.UserRole + 2 - WeightRole = Qt.UserRole + 3 - QualitiesRole = Qt.UserRole + 4 - DescriptionRole = Qt.UserRole + 5 + NameRole = Qt.ItemDataRole.UserRole + 1 + IntentCategoryRole = Qt.ItemDataRole.UserRole + 2 + WeightRole = Qt.ItemDataRole.UserRole + 3 + QualitiesRole = Qt.ItemDataRole.UserRole + 4 + DescriptionRole = Qt.ItemDataRole.UserRole + 5 modelUpdated = pyqtSignal() diff --git a/cura/Machines/Models/IntentModel.py b/cura/Machines/Models/IntentModel.py index 6d58cfe3ce..9fb8ff0376 100644 --- a/cura/Machines/Models/IntentModel.py +++ b/cura/Machines/Models/IntentModel.py @@ -15,11 +15,11 @@ from cura.Machines.QualityGroup import QualityGroup class IntentModel(ListModel): - NameRole = Qt.UserRole + 1 - QualityTypeRole = Qt.UserRole + 2 - LayerHeightRole = Qt.UserRole + 3 - AvailableRole = Qt.UserRole + 4 - IntentRole = Qt.UserRole + 5 + NameRole = Qt.ItemDataRole.UserRole + 1 + QualityTypeRole = Qt.ItemDataRole.UserRole + 2 + LayerHeightRole = Qt.ItemDataRole.UserRole + 3 + AvailableRole = Qt.ItemDataRole.UserRole + 4 + IntentRole = Qt.ItemDataRole.UserRole + 5 def __init__(self, parent: Optional[QObject] = None) -> None: super().__init__(parent) diff --git a/cura/Machines/Models/MaterialBrandsModel.py b/cura/Machines/Models/MaterialBrandsModel.py index 8da1dd653c..42554ca05f 100644 --- a/cura/Machines/Models/MaterialBrandsModel.py +++ b/cura/Machines/Models/MaterialBrandsModel.py @@ -10,9 +10,9 @@ class MaterialTypesModel(ListModel): def __init__(self, parent = None): super().__init__(parent) - self.addRoleName(Qt.UserRole + 1, "name") - self.addRoleName(Qt.UserRole + 2, "brand") - self.addRoleName(Qt.UserRole + 3, "colors") + self.addRoleName(Qt.ItemDataRole.UserRole + 1, "name") + self.addRoleName(Qt.ItemDataRole.UserRole + 2, "brand") + self.addRoleName(Qt.ItemDataRole.UserRole + 3, "colors") class MaterialBrandsModel(BaseMaterialsModel): @@ -21,8 +21,8 @@ class MaterialBrandsModel(BaseMaterialsModel): def __init__(self, parent = None): super().__init__(parent) - self.addRoleName(Qt.UserRole + 1, "name") - self.addRoleName(Qt.UserRole + 2, "material_types") + self.addRoleName(Qt.ItemDataRole.UserRole + 1, "name") + self.addRoleName(Qt.ItemDataRole.UserRole + 2, "material_types") self._update() diff --git a/cura/Machines/Models/NozzleModel.py b/cura/Machines/Models/NozzleModel.py index 4351f2568d..2083866ac5 100644 --- a/cura/Machines/Models/NozzleModel.py +++ b/cura/Machines/Models/NozzleModel.py @@ -10,9 +10,9 @@ from cura.Machines.ContainerTree import ContainerTree class NozzleModel(ListModel): - IdRole = Qt.UserRole + 1 - HotendNameRole = Qt.UserRole + 2 - ContainerNodeRole = Qt.UserRole + 3 + IdRole = Qt.ItemDataRole.UserRole + 1 + HotendNameRole = Qt.ItemDataRole.UserRole + 2 + ContainerNodeRole = Qt.ItemDataRole.UserRole + 3 def __init__(self, parent = None): super().__init__(parent) diff --git a/cura/Machines/Models/QualityManagementModel.py b/cura/Machines/Models/QualityManagementModel.py index 666afad307..8db8719784 100644 --- a/cura/Machines/Models/QualityManagementModel.py +++ b/cura/Machines/Models/QualityManagementModel.py @@ -29,13 +29,13 @@ if TYPE_CHECKING: class QualityManagementModel(ListModel): """This the QML model for the quality management page.""" - NameRole = Qt.UserRole + 1 - IsReadOnlyRole = Qt.UserRole + 2 - QualityGroupRole = Qt.UserRole + 3 - QualityTypeRole = Qt.UserRole + 4 - QualityChangesGroupRole = Qt.UserRole + 5 - IntentCategoryRole = Qt.UserRole + 6 - SectionNameRole = Qt.UserRole + 7 + NameRole = Qt.ItemDataRole.UserRole + 1 + IsReadOnlyRole = Qt.ItemDataRole.UserRole + 2 + QualityGroupRole = Qt.ItemDataRole.UserRole + 3 + QualityTypeRole = Qt.ItemDataRole.UserRole + 4 + QualityChangesGroupRole = Qt.ItemDataRole.UserRole + 5 + IntentCategoryRole = Qt.ItemDataRole.UserRole + 6 + SectionNameRole = Qt.ItemDataRole.UserRole + 7 def __init__(self, parent: Optional["QObject"] = None) -> None: super().__init__(parent) diff --git a/cura/Machines/Models/QualityProfilesDropDownMenuModel.py b/cura/Machines/Models/QualityProfilesDropDownMenuModel.py index 6b74ac5175..b3f92a06f4 100644 --- a/cura/Machines/Models/QualityProfilesDropDownMenuModel.py +++ b/cura/Machines/Models/QualityProfilesDropDownMenuModel.py @@ -13,14 +13,14 @@ from cura.Machines.Models.MachineModelUtils import fetchLayerHeight class QualityProfilesDropDownMenuModel(ListModel): """QML Model for all built-in quality profiles. This model is used for the drop-down quality menu.""" - NameRole = Qt.UserRole + 1 - QualityTypeRole = Qt.UserRole + 2 - LayerHeightRole = Qt.UserRole + 3 - LayerHeightUnitRole = Qt.UserRole + 4 - AvailableRole = Qt.UserRole + 5 - QualityGroupRole = Qt.UserRole + 6 - QualityChangesGroupRole = Qt.UserRole + 7 - IsExperimentalRole = Qt.UserRole + 8 + NameRole = Qt.ItemDataRole.UserRole + 1 + QualityTypeRole = Qt.ItemDataRole.UserRole + 2 + LayerHeightRole = Qt.ItemDataRole.UserRole + 3 + LayerHeightUnitRole = Qt.ItemDataRole.UserRole + 4 + AvailableRole = Qt.ItemDataRole.UserRole + 5 + QualityGroupRole = Qt.ItemDataRole.UserRole + 6 + QualityChangesGroupRole = Qt.ItemDataRole.UserRole + 7 + IsExperimentalRole = Qt.ItemDataRole.UserRole + 8 def __init__(self, parent = None): super().__init__(parent) diff --git a/cura/Machines/Models/QualitySettingsModel.py b/cura/Machines/Models/QualitySettingsModel.py index dc1da7b309..0780a51357 100644 --- a/cura/Machines/Models/QualitySettingsModel.py +++ b/cura/Machines/Models/QualitySettingsModel.py @@ -16,13 +16,13 @@ import os class QualitySettingsModel(ListModel): """This model is used to show details settings of the selected quality in the quality management page.""" - KeyRole = Qt.UserRole + 1 - LabelRole = Qt.UserRole + 2 - UnitRole = Qt.UserRole + 3 - ProfileValueRole = Qt.UserRole + 4 - ProfileValueSourceRole = Qt.UserRole + 5 - UserValueRole = Qt.UserRole + 6 - CategoryRole = Qt.UserRole + 7 + KeyRole = Qt.ItemDataRole.UserRole + 1 + LabelRole = Qt.ItemDataRole.UserRole + 2 + UnitRole = Qt.ItemDataRole.UserRole + 3 + ProfileValueRole = Qt.ItemDataRole.UserRole + 4 + ProfileValueSourceRole = Qt.ItemDataRole.UserRole + 5 + UserValueRole = Qt.ItemDataRole.UserRole + 6 + CategoryRole = Qt.ItemDataRole.UserRole + 7 GLOBAL_STACK_POSITION = -1 diff --git a/cura/Machines/Models/UserChangesModel.py b/cura/Machines/Models/UserChangesModel.py index 95b1e84cf7..171e910dd8 100644 --- a/cura/Machines/Models/UserChangesModel.py +++ b/cura/Machines/Models/UserChangesModel.py @@ -15,12 +15,12 @@ from UM.Qt.ListModel import ListModel class UserChangesModel(ListModel): - KeyRole = Qt.UserRole + 1 - LabelRole = Qt.UserRole + 2 - ExtruderRole = Qt.UserRole + 3 - OriginalValueRole = Qt.UserRole + 4 - UserValueRole = Qt.UserRole + 6 - CategoryRole = Qt.UserRole + 7 + KeyRole = Qt.ItemDataRole.UserRole + 1 + LabelRole = Qt.ItemDataRole.UserRole + 2 + ExtruderRole = Qt.ItemDataRole.UserRole + 3 + OriginalValueRole = Qt.ItemDataRole.UserRole + 4 + UserValueRole = Qt.ItemDataRole.UserRole + 6 + CategoryRole = Qt.ItemDataRole.UserRole + 7 def __init__(self, parent = None): super().__init__(parent = parent) |