Files
metabuilder/qml/components/layout/CContainer.qml
johndoe6345789 6e394d7846 style(qt6): 80-char margin enforced — 737 violations → 29 remaining
191 files reformatted across views, components, widgets, hybrid, contexts.
New components: CCreateSchemaDialog, CAddFieldDialog, CAdminContentPanel.
JS helpers: connBadgeStatus/Text, adminStats, exampleLabels, onLevelClicked.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 15:48:39 +00:00

58 lines
1.6 KiB
QML

import QtQuick
import QmlComponents 1.0
/**
* CContainer.qml - Responsive container with max-width (mirrors CSS container)
* Automatically centers content and applies responsive max-width
*
* Usage:
* CContainer {
* CGrid {
* variant: "responsive"
* columnsMobile: 1
* columnsDesktop: 3
* ...
* }
* }
*/
Item {
id: root
// Properties
property string size: "lg" // sm, md, lg, xl, full
property int paddingH: Responsive.isMobile
? StyleVariables.spacingSm : StyleVariables.spacingMd
property int paddingV: 0
property bool centerContent: true
// Content slot
default property alias content: contentItem.data
// Max width based on size
readonly property int _maxWidth: {
switch (size) {
case "sm": return 600
case "md": return 900
case "lg": return 1200
case "xl": return 1536
case "full": return parent ? parent.width : 99999
default: return 1200
}
}
// Sizing
implicitWidth: parent ? parent.width : 400
implicitHeight: contentItem.implicitHeight + (paddingV * 2)
// Content wrapper with max-width
Item {
id: contentItem
width: Math.min(root.width - (root.paddingH * 2), root._maxWidth)
anchors.horizontalCenter: root.centerContent
? parent.horizontalCenter : undefined
x: root.centerContent ? undefined : root.paddingH
y: root.paddingV
implicitHeight: childrenRect.height
}
}