Files
metabuilder/qml/components/form/CLabel.qml
johndoe6345789 de3a3ac194 feat(qml): MD3 rework batch 2 — 17 more components rewritten
Feedback: CAlert (tonal + accent bar), CDialog (radius 28, scale anim), CSnackbar (inverse surface, slide-in)
Navigation: CTabBar (animated indicator pill), CListItem (state layers), CBreadcrumbs (full rewrite)
Data: CAvatar (tonal primary), CDivider (theme-aware), CTable (hover rows, sort arrows, proper padding)
Typography: CText (full MD3 type scale inline), CTitle (extends CText), CCodeBlock (radius 12), CCodeInline (radius 4)
Forms: CFormGroup (focus/error states), CFormLabel (animated color), CLabel (control association), CAutocomplete (styled popup)

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

43 lines
1.0 KiB
QML

import QtQuick
import QmlComponents 1.0
/**
* CLabel.qml - Material Design 3 simple text label
* 14px body label associated with a form control
*/
Text {
id: root
property string size: "md" // sm, md, lg
property bool required: false
property bool disabled: false
property Item control: null
color: disabled ? Theme.textDisabled : Theme.text
opacity: disabled ? 0.38 : 1
font.pixelSize: {
switch (size) {
case "sm": return 12
case "lg": return 16
default: return 14
}
}
font.weight: Font.Normal
font.family: Theme.fontFamily
// Append asterisk for required fields
text: text + (required ? " *" : "")
// Clicking the label focuses the associated control
MouseArea {
anchors.fill: parent
cursorShape: root.control ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: {
if (root.control && root.control.forceActiveFocus) {
root.control.forceActiveFocus()
}
}
}
}