Quickshell


ObjectModel: class

uncreatable
import Quickshell

Typed view into a list of objects.

An ObjectModel works as a QML Data Model, allowing efficient interaction with components that act on models. It has a single role named modelData, to match the behavior of lists. The same information contained in the list model is available as a normal list via the values property.

Differences from a list

Unlike with a list, the following property binding will never be updated when model[3] changes.

// will not update reactively
property var foo: model[3]

You can work around this limitation using the Go to values property of the model to view it as a list.

// will update reactively
property var foo: model.values[3]
  • values list <QtObject>
    readonly

    The content of the object model, as a QML list. The values of this property will always be of the type of the model.

  • indexOf(object) int

    Property objectQtObject

    No details provided
  • objectInsertedPost(object, index)   ?

    Property objectQtObject Property indexint

    Sent immediately after an object is inserted into the list.

  • objectInsertedPre(object, index)   ?

    Property objectQtObject Property indexint

    Sent immediately before an object is inserted into the list.

  • objectRemovedPost(object, index)   ?

    Property objectQtObject Property indexint

    Sent immediately after an object is removed from the list.

  • objectRemovedPre(object, index)   ?

    Property objectQtObject Property indexint

    Sent immediately before an object is removed from the list.