forked from quickshell/quickshell
service/notifications: add notifications service
This commit is contained in:
parent
79cbfba48a
commit
d630cc7f76
15 changed files with 1249 additions and 0 deletions
|
@ -72,3 +72,8 @@ bool UntypedObjectModel::removeObject(const QObject* object) {
|
|||
}
|
||||
|
||||
qsizetype UntypedObjectModel::indexOf(QObject* object) { return this->valuesList.indexOf(object); }
|
||||
|
||||
UntypedObjectModel* UntypedObjectModel::emptyInstance() {
|
||||
static auto* instance = new UntypedObjectModel(nullptr); // NOLINT
|
||||
return instance;
|
||||
}
|
||||
|
|
|
@ -55,6 +55,8 @@ public:
|
|||
|
||||
Q_INVOKABLE qsizetype indexOf(QObject* object);
|
||||
|
||||
static UntypedObjectModel* emptyInstance();
|
||||
|
||||
signals:
|
||||
void valuesChanged();
|
||||
/// Sent immediately before an object is inserted into the list.
|
||||
|
@ -82,6 +84,10 @@ class ObjectModel: public UntypedObjectModel {
|
|||
public:
|
||||
explicit ObjectModel(QObject* parent): UntypedObjectModel(parent) {}
|
||||
|
||||
[[nodiscard]] QVector<T*>& valueList() {
|
||||
return *reinterpret_cast<QVector<T*>*>(&this->valuesList); // NOLINT
|
||||
}
|
||||
|
||||
[[nodiscard]] const QVector<T*>& valueList() const {
|
||||
return *reinterpret_cast<const QVector<T*>*>(&this->valuesList); // NOLINT
|
||||
}
|
||||
|
@ -91,4 +97,8 @@ public:
|
|||
}
|
||||
|
||||
void removeObject(const T* object) { this->UntypedObjectModel::removeObject(object); }
|
||||
|
||||
static ObjectModel<T>* emptyInstance() {
|
||||
return static_cast<ObjectModel<T>*>(UntypedObjectModel::emptyInstance());
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue