From c095cb1f226a0fdaaf9f8da5ab245cd8820266d8 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 4 Jun 2020 14:06:03 +0200 Subject: [PATCH] Converted the listview into a RowLayout I have no idea why i thought a listview was needed for this when this was made. The data shouldn't be flicable, so it makes way more sense to use a row layout CURA-7480 --- .../ConfigurationMenu/ConfigurationMenu.qml | 109 +++++++++--------- 1 file changed, 54 insertions(+), 55 deletions(-) diff --git a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml index f0ada92810..9891fc1d69 100644 --- a/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml +++ b/resources/qml/Menus/ConfigurationMenu/ConfigurationMenu.qml @@ -4,6 +4,7 @@ import QtQuick 2.10 import QtQuick.Controls 2.3 import QtQuick.Controls.Styles 1.4 +import QtQuick.Layouts 1.3 import UM 1.2 as UM import Cura 1.0 as Cura @@ -37,70 +38,68 @@ Cura.ExpandablePopup headerItem: Item { // Horizontal list that shows the extruders and their materials - ListView + RowLayout { - id: extrudersList - - orientation: ListView.Horizontal anchors.fill: parent - model: extrudersModel - visible: Cura.MachineManager.activeMachine.hasMaterials - - delegate: Item + Repeater { - height: parent.height - width: Math.round(ListView.view.width / extrudersModel.count) - - // Extruder icon. Shows extruder index and has the same color as the active material. - Cura.ExtruderIcon + model: extrudersModel + delegate: Item { - id: extruderIcon - materialColor: model.color - extruderEnabled: model.enabled - height: parent.height - width: height - } + Layout.fillWidth: true + Layout.fillHeight: true - // Label for the brand of the material - Label - { - id: typeAndBrandNameLabel - - text: model.material_brand + " " + model.material - elide: Text.ElideRight - font: UM.Theme.getFont("default") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering - - anchors + // Extruder icon. Shows extruder index and has the same color as the active material. + Cura.ExtruderIcon { - top: extruderIcon.top - left: extruderIcon.right - leftMargin: UM.Theme.getSize("default_margin").width - right: parent.right - rightMargin: UM.Theme.getSize("default_margin").width + id: extruderIcon + materialColor: model.color + extruderEnabled: model.enabled + height: parent.height + width: height } - } - // Label that shows the name of the variant - Label - { - id: variantLabel - visible: Cura.MachineManager.activeMachine.hasVariants - - text: model.variant - elide: Text.ElideRight - font: UM.Theme.getFont("default_bold") - color: UM.Theme.getColor("text") - renderType: Text.NativeRendering - - anchors + // Label for the brand of the material + Label { - left: extruderIcon.right - leftMargin: UM.Theme.getSize("default_margin").width - top: typeAndBrandNameLabel.bottom - right: parent.right - rightMargin: UM.Theme.getSize("default_margin").width + id: typeAndBrandNameLabel + + text: model.material_brand + " " + model.material + elide: Text.ElideRight + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + + anchors + { + top: extruderIcon.top + left: extruderIcon.right + leftMargin: UM.Theme.getSize("default_margin").width + right: parent.right + rightMargin: UM.Theme.getSize("default_margin").width + } + } + // Label that shows the name of the variant + Label + { + id: variantLabel + + visible: Cura.MachineManager.activeMachine.hasVariants + + text: model.variant + elide: Text.ElideRight + font: UM.Theme.getFont("default_bold") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + + anchors + { + left: extruderIcon.right + leftMargin: UM.Theme.getSize("default_margin").width + top: typeAndBrandNameLabel.bottom + right: parent.right + rightMargin: UM.Theme.getSize("default_margin").width + } } } }