Variants: Reloadable

import Quickshell

Creates instances of a component based on a given model. More

Properties

Detailed Description

Creates and destroys instances of the given component when the given property changes.

Variants is similar to Repeater except it is for non Item objects, and acts as a reload scope.

Each non duplicate value passed to model will create a new instance of delegate with its modelData property set to that value.

See Quickshell.screens for an example of using Variants to create copies of a window per screen.

⚠️
BUG: Variants currently fails to reload children if the variant set is changed as it is instantiated. (usually due to a mutation during variant creation)

Property Details

[default]

delegate: Component

The component to create instances of.

The delegate should define a modelData property that will be popuplated with a value from the model.

[readonly]

instances: list<QtObject>

Current instances of the delegate.

model: list<variant>

The list of sets of properties to create instances with. Each set creates an instance of the component, which are updated when the input sets update.