{ "name": "Variants", "module": "Quickshell", "type": "class", "super": { "type": "local", "module": "Quickshell", "name": "Reloadable" }, "description": "Creates instances of a component based on a given model.", "details": "Creates and destroys instances of the given component when the given property changes.\n\n`Variants` is similar to {{< qmltypelink type=\"qt\" module=\"qml.QtQuick\" name=\"Repeater\" mtype=\"\" mname=\"\" >}} except it is for *non {{< qmltypelink type=\"qt\" module=\"qml.QtQuick\" name=\"Item\" mtype=\"\" mname=\"\" >}}* objects, and acts as\na reload scope.\n\nEach non duplicate value passed to {{< qmltypelink type=\"\" module=\"\" name=\"\" mtype=\"prop\" mname=\"model\" >}} will create a new instance of\n{{< qmltypelink type=\"\" module=\"\" name=\"\" mtype=\"prop\" mname=\"delegate\" >}} with a `modelData` property set to that value.\n\nSee {{< qmltypelink type=\"local\" module=\"Quickshell\" name=\"Quickshell\" mtype=\"prop\" mname=\"screens\" >}} for an example of using `Variants` to create copies of a window per\nscreen.\n\n{{< callout type=\"warning\" >}}\n BUG: Variants currently fails to reload children if the variant set is changed as\nit is instantiated. (usually due to a mutation during variant creation)\n\n{{< /callout >}}", "properties": { "model": { "type": { "type": "qt", "module": "qml", "name": "list", "of": { "type": "qt", "module": "qml", "name": "variant" } }, "details": "The list of sets of properties to create instances with.\nEach set creates an instance of the component, which are updated when the input sets update.\n" }, "delegate": { "type": { "type": "qt", "module": "qml.QtQml", "name": "Component" }, "details": "The component to create instances of.\n\nThe delegate should define a `modelData` property that will be popuplated with a value\nfrom the {{< qmltypelink type=\"\" module=\"\" name=\"\" mtype=\"prop\" mname=\"model\" >}}.\n", "flags": [ "default" ] }, "instances": { "type": { "type": "qt", "module": "qml", "name": "list", "of": { "type": "qt", "module": "qml.QtQml", "name": "QtObject" } }, "details": "Current instances of the delegate.\n", "flags": [ "readonly" ] } }, "functions": [], "signals": {}, "variants": {} }