Files
metabuilder/fakemui/qml-components/layout/CGridItem.qml
git 58a94d0489 feat(styles): add component-specific styles for TaskDetail, SearchDialog, and Documentation
feat(styles): create global styles entry point and organize global styles

feat(styles): implement base HTML element styles and utility classes for flexbox

feat(styles): establish layout, position, spacing, and text utility classes

feat(styles): introduce mixins for animations, cards, dialogs, flexbox, grid, and responsive design

test(quick_guide): add component and metadata validation tests for quick_guide package

test(ui_level6): implement metadata validation tests for ui_level6 package
2025-12-30 02:29:58 +00:00

54 lines
1.4 KiB
QML

import QtQuick
/**
* CGridItem.qml - Grid item wrapper for CGrid
* Provides consistent sizing and optional span properties
*
* Usage:
* CGrid {
* columns: 3
*
* CGridItem { Text { text: "Item 1" } }
* CGridItem { colSpan: 2; Text { text: "Wide item" } }
* CGridItem { Text { text: "Item 3" } }
* }
*/
Item {
id: root
// Public properties
property int colSpan: 1 // Number of columns to span
property int rowSpan: 1 // Number of rows to span
property string align: "" // Override alignment: start, center, end, stretch
// Content slot
default property alias content: contentItem.data
// Layout properties for GridLayout
Layout.columnSpan: colSpan
Layout.rowSpan: rowSpan
Layout.fillWidth: true
Layout.fillHeight: rowSpan > 1
Layout.alignment: {
switch (align) {
case "start": return Qt.AlignLeft | Qt.AlignTop
case "center": return Qt.AlignHCenter | Qt.AlignVCenter
case "end": return Qt.AlignRight | Qt.AlignBottom
default: return Qt.AlignLeft | Qt.AlignTop
}
}
// Size based on content
implicitHeight: contentItem.implicitHeight
implicitWidth: contentItem.implicitWidth
// Content wrapper
Item {
id: contentItem
anchors.fill: parent
implicitWidth: childrenRect.width
implicitHeight: childrenRect.height
}
}