forked from quickshell/quickshell
Revert "core/region: use QList over QQmlListProperty for child regions"
This reverts commit 0c9c5be8dd.
Using QList breaks the default property usage.
This commit is contained in:
parent
05fbead660
commit
5ac9096c1c
2 changed files with 79 additions and 31 deletions
|
|
@ -82,7 +82,7 @@ class PendingRegion: public QObject {
|
|||
/// }
|
||||
/// }
|
||||
/// ```
|
||||
Q_PROPERTY(QList<PendingRegion*> regions READ regions WRITE setRegions NOTIFY regionsChanged);
|
||||
Q_PROPERTY(QQmlListProperty<PendingRegion> regions READ regions);
|
||||
Q_CLASSINFO("DefaultProperty", "regions");
|
||||
QML_NAMED_ELEMENT(Region);
|
||||
|
||||
|
|
@ -91,8 +91,7 @@ public:
|
|||
|
||||
void setItem(QQuickItem* item);
|
||||
|
||||
[[nodiscard]] const QList<PendingRegion*>& regions() const;
|
||||
void setRegions(const QList<PendingRegion*>& regions);
|
||||
QQmlListProperty<PendingRegion> regions();
|
||||
|
||||
[[nodiscard]] bool empty() const;
|
||||
[[nodiscard]] QRegion build() const;
|
||||
|
|
@ -110,7 +109,6 @@ signals:
|
|||
void yChanged();
|
||||
void widthChanged();
|
||||
void heightChanged();
|
||||
void regionsChanged();
|
||||
void childrenChanged();
|
||||
|
||||
/// Triggered when the region's geometry changes.
|
||||
|
|
@ -124,6 +122,14 @@ private slots:
|
|||
void onChildDestroyed();
|
||||
|
||||
private:
|
||||
static void regionsAppend(QQmlListProperty<PendingRegion>* prop, PendingRegion* region);
|
||||
static PendingRegion* regionAt(QQmlListProperty<PendingRegion>* prop, qsizetype i);
|
||||
static void regionsClear(QQmlListProperty<PendingRegion>* prop);
|
||||
static qsizetype regionsCount(QQmlListProperty<PendingRegion>* prop);
|
||||
static void regionsRemoveLast(QQmlListProperty<PendingRegion>* prop);
|
||||
static void
|
||||
regionsReplace(QQmlListProperty<PendingRegion>* prop, qsizetype i, PendingRegion* region);
|
||||
|
||||
QQuickItem* mItem = nullptr;
|
||||
|
||||
qint32 mX = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue