BoundComponent

BoundComponent: Item

import Quickshell

Component loader that allows setting initial properties. More

Properties

Detailed Description

Component loader that allows setting initial properties, primarily useful for escaping cyclic dependency errors.

Properties defined on the BoundComponent will be applied to its loaded component, including required properties, and will remain reactive. Functions created with the names of signal handlers will also be attached to signals of the loaded component.

MyComponent.qml
MouseArea {
  required property color color;
  width: 100
  height: 100

  Rectangle {
    anchors.fill: parent
    color: parent.color
  }
}
BoundComponent {
  source: "MyComponent.qml"

  // this is the same as assigning to `color` on MyComponent if loaded normally.
  property color color: "red";

  // this will be triggered when the `clicked` signal from the MouseArea is sent.
  function onClicked() {
    color = "blue";
  }
}

Property Details

bindValues: bool

If property values should be bound after they are initially set. Defaults to true.

[readonly]

implicitHeight: real

No details provided.

[readonly]

implicitWidth: real

No details provided.

[readonly]

item: QtObject

The loaded component. Will be null until it has finished loading.

source: string

The source to load, as a Url.

sourceComponent: Component

The source to load, as a Component.