From e93ecd369991dd2f64f89c17326390bf967189c6 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 5 Nov 2021 09:26:27 +0100 Subject: [PATCH] Move what is already there of 'package card' to it's own file. part of CURA-8561 --- .../Marketplace/resources/qml/PackageCard.qml | 28 +++++++++++++++++++ .../Marketplace/resources/qml/Packages.qml | 19 ++----------- 2 files changed, 30 insertions(+), 17 deletions(-) create mode 100644 plugins/Marketplace/resources/qml/PackageCard.qml diff --git a/plugins/Marketplace/resources/qml/PackageCard.qml b/plugins/Marketplace/resources/qml/PackageCard.qml new file mode 100644 index 0000000000..0a6c33a5b9 --- /dev/null +++ b/plugins/Marketplace/resources/qml/PackageCard.qml @@ -0,0 +1,28 @@ +// Copyright (c) 2021 Ultimaker B.V. +// Cura is released under the terms of the LGPLv3 or higher. + +import QtQuick 2.15 +import QtQuick.Controls 2.15 +import UM 1.4 as UM + +Rectangle +{ + property var packageData + + width: parent.width + height: UM.Theme.getSize("card").height + + color: UM.Theme.getColor("main_background") + radius: UM.Theme.getSize("default_radius").width + + Label + { + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: Math.round((parent.height - height) / 2) + + text: packageData.displayName + font: UM.Theme.getFont("medium_bold") + color: UM.Theme.getColor("text") + } +} diff --git a/plugins/Marketplace/resources/qml/Packages.qml b/plugins/Marketplace/resources/qml/Packages.qml index c9ddf88d16..95064c4469 100644 --- a/plugins/Marketplace/resources/qml/Packages.qml +++ b/plugins/Marketplace/resources/qml/Packages.qml @@ -46,24 +46,9 @@ ScrollView } } - delegate: Rectangle + delegate: PackageCard { - width: packagesListview.width - height: UM.Theme.getSize("card").height - - color: UM.Theme.getColor("main_background") - radius: UM.Theme.getSize("default_radius").width - - Label - { - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: Math.round((parent.height - height) / 2) - - text: model.package.displayName - font: UM.Theme.getFont("medium_bold") - color: UM.Theme.getColor("text") - } + packageData: model.package } //Wrapper item to add spacing between content and footer.