/*
* Copyright 2016 Canonical Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see .
*/
#ifndef ACTIONLIST_P_H
#define ACTIONLIST_P_H
#include
#include
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include
#else
#include
#endif
UT_NAMESPACE_BEGIN
class UCAction;
class LOMIRITOOLKIT_EXPORT ActionList : public QObject
{
Q_OBJECT
Q_PROPERTY(QQmlListProperty actions READ actions)
// children alias
Q_PROPERTY(QQmlListProperty children READ actions NOTIFY childrenChanged)
Q_CLASSINFO("DefaultProperty", "children")
public:
explicit ActionList(QObject *parent = 0);
QQmlListProperty actions();
const QList &list() const;
public Q_SLOTS:
void addAction(UT_PREPEND_NAMESPACE(UCAction) *action);
void removeAction(UT_PREPEND_NAMESPACE(UCAction) *action);
Q_SIGNALS:
void childrenChanged();
void added(UCAction *action);
void removed(UCAction *action);
protected:
QList m_actions;
static void append(QQmlListProperty *list, UCAction *action);
static void clear(QQmlListProperty *list);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
static UCAction* at(QQmlListProperty *list, qsizetype index);
static qsizetype count(QQmlListProperty *list);
#else
static UCAction* at(QQmlListProperty *list, int index);
static int count(QQmlListProperty *list);
#endif
};
UT_NAMESPACE_END
#endif // ACTIONLIST_P_H