From 9d2e753a8aada71c68a56dec901314d061817595 Mon Sep 17 00:00:00 2001 From: talksik Date: Fri, 11 Apr 2025 12:11:08 -0700 Subject: [PATCH] feat: add card --- AppCard.qml | 28 ++++++++++++++++++++++++++++ CMakeLists.txt | 1 + 2 files changed, 29 insertions(+) create mode 100644 AppCard.qml diff --git a/AppCard.qml b/AppCard.qml new file mode 100644 index 0000000..e7f2c63 --- /dev/null +++ b/AppCard.qml @@ -0,0 +1,28 @@ +import QtQuick +import QtQuick.Controls.Basic + +Item { + id: root + + property real padding: 10 + + // Automatically size based on content plus padding + implicitWidth: contentItem.childrenRect.width + padding * 2 + implicitHeight: contentItem.childrenRect.height + padding * 2 + + // Background + Rectangle { + anchors.fill: parent + color: Theme.card + radius: Theme.radius + } + + // This allows direct assignment of children to AppCard + default property alias content: contentItem.children + // Content container + Item { + id: contentItem + anchors.fill: parent + anchors.margins: padding + } +} diff --git a/CMakeLists.txt b/CMakeLists.txt index fdca990..f89a276 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,7 @@ set(plain_qml_files AppText.qml AppIcon.qml AppPrimaryButton.qml + AppCard.qml ) set(qml_singletons Fonts.qml