Debian Codegraph @

qml/Lomiri/Action/qml-context.h

raw
1 /* This file is part of lomiri-action-api
2 * Copyright 2013 Canonical Ltd.
3 *
4 * lomiri-action-api is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * lomiri-action-api is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17 #ifndef LOMIRI_ACTION_QML_ACTION_CONTEXT
18 #define LOMIRI_ACTION_QML_ACTION_CONTEXT
19
20 namespace lomiri {
21 namespace action {
22 namespace qml {
23 class ActionContext;
24 }
25 }
26 }
27
28 #include <QQmlListProperty>
29
30 #include <lomiri/action/ActionContext>
31 #include <lomiri/action/Action>
32
33 # if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
34 #define QQMLISTPROPERTY_INT qsizetype
35 # else
36 #define QQMLISTPROPERTY_INT int
37 # endif
38
39 class Q_DECL_EXPORT lomiri::action::qml::ActionContext : public lomiri::action::ActionContext
40 {
41 Q_OBJECT
42 Q_DISABLE_COPY(ActionContext)
43
44 Q_PROPERTY(QQmlListProperty<lomiri::action::Action> actions
45 READ action_list)
46
47 Q_CLASSINFO("DefaultProperty", "actions")
48
49 public:
50 explicit ActionContext(QObject *parent = 0);
51 virtual ~ActionContext();
52
53 QQmlListProperty<lomiri::action::Action> action_list();
54
55 private:
56
57 static void append(QQmlListProperty<lomiri::action::Action> *list,lomiri::action::Action *action);
58 static void clear(QQmlListProperty<lomiri::action::Action> *list);
59 static QQMLISTPROPERTY_INT count(QQmlListProperty<lomiri::action::Action> *list);
60
61 };
62 #endif