Files
metabuilder/qml/MetaBuilder/CNotificationToggles.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

56 lines
1.4 KiB
QML

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QmlComponents 1.0
/**
* CNotificationToggles - Data-driven notification preference toggles.
*
* model: JSON array of { id, title, description }
* values: Object mapping id → bool (e.g. { emailNotifications: true })
* Emits toggled(id, value) when any switch changes.
*/
ColumnLayout {
id: root
spacing: 0
property var model: []
property var values: ({})
signal toggled(string id, bool value)
Repeater {
model: root.model
delegate: ColumnLayout {
Layout.fillWidth: true
spacing: 0
CDivider {
Layout.fillWidth: true
visible: index > 0
}
FlexRow {
Layout.fillWidth: true
Layout.topMargin: index === 0 ? 4 : 0
spacing: 12
ColumnLayout {
Layout.fillWidth: true
spacing: 2
CText { variant: "subtitle2"; text: modelData.title }
CText { variant: "caption"; text: modelData.description
opacity: 0.6 }
}
CSwitch {
checked: root.values[modelData.id] || false
onToggled: function(value) {
root.toggled(modelData.id, value)
}
}
}
}
}
}