forked from quickshell/quickshell
core/scriptmodel: improve docs
This commit is contained in:
parent
6d8022b709
commit
6024c37492
1 changed files with 14 additions and 1 deletions
|
@ -36,6 +36,8 @@
|
||||||
/// delegate: // ...
|
/// delegate: // ...
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
/// [QAbstractItemModel]: https://doc.qt.io/qt-6/qabstractitemmodel.html
|
||||||
|
/// [Data Model]: https://doc.qt.io/qt-6/qtquick-modelviewsdata-modelview.html#qml-data-models
|
||||||
class ScriptModel: public QAbstractListModel {
|
class ScriptModel: public QAbstractListModel {
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
/// The list of values to reflect in the model.
|
/// The list of values to reflect in the model.
|
||||||
|
@ -51,8 +53,19 @@ class ScriptModel: public QAbstractListModel {
|
||||||
/// > }
|
/// > }
|
||||||
/// > ```
|
/// > ```
|
||||||
/// >
|
/// >
|
||||||
/// > Note that we are using @@DesktopEntries.values because it will cause @@ScriptModel.values
|
/// > Note that we are using @@ObjectModel.values because it will cause @@ScriptModel.values
|
||||||
/// > to receive an update on change.
|
/// > to receive an update on change.
|
||||||
|
///
|
||||||
|
/// > [!TIP] Most lists exposed by Quickshell are read-only. Some operations like `sort()`
|
||||||
|
/// > act on a list in-place and cannot be used directly on a list exposed by Quickshell.
|
||||||
|
/// > You can copy a list using spread syntax: `[...variable]` instead of `variable`.
|
||||||
|
/// >
|
||||||
|
/// > For example:
|
||||||
|
/// > ```qml
|
||||||
|
/// > ScriptModel {
|
||||||
|
/// > values: [...DesktopEntries.applications.values].sort(...)
|
||||||
|
/// > }
|
||||||
|
/// > ```
|
||||||
Q_PROPERTY(QVariantList values READ values WRITE setValues NOTIFY valuesChanged);
|
Q_PROPERTY(QVariantList values READ values WRITE setValues NOTIFY valuesChanged);
|
||||||
QML_ELEMENT;
|
QML_ELEMENT;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue