ArnLib  4.0.x
Active Registry Network
ArnQmlMQt.hpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2022 Michael Wiklund.
2 // All rights reserved.
3 // Contact: arnlib@wiklunden.se
4 //
5 // This file is part of the ArnLib - Active Registry Network.
6 // Parts of ArnLib depend on Qt and/or other libraries that have their own
7 // licenses. Usage of these other libraries is subject to their respective
8 // license agreements.
9 //
10 // The MIT License (MIT) Usage
11 // Permission is hereby granted, free of charge, to any person obtaining a
12 // copy of this file to deal in its contained Software without restriction,
13 // including without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to permit
15 // persons to whom the Software is furnished to do so, subject to the
16 // following conditions:
17 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software in this file.
19 //
20 // GNU Lesser General Public License Usage
21 // This file may be used under the terms of the GNU Lesser General Public
22 // License version 2.1 as published by the Free Software Foundation and
23 // appearing in the file LICENSE_LGPL.txt included in the packaging of this
24 // file. In addition, as a special exception, you may use the rights described
25 // in the Nokia Qt LGPL Exception version 1.1, included in the file
26 // LGPL_EXCEPTION.txt in this package.
27 //
28 // GNU General Public License Usage
29 // Alternatively, this file may be used under the terms of the GNU General Public
30 // License version 3.0 as published by the Free Software Foundation and appearing
31 // in the file LICENSE_GPL.txt included in the packaging of this file.
32 //
33 // Other Usage
34 // Alternatively, this file may be used in accordance with the terms and conditions
35 // contained in a signed written agreement between you and Michael Wiklund.
36 //
37 // This program is distributed in the hope that it will be useful, but WITHOUT ANY
38 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
39 // PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
40 //
41 
42 #ifndef ARNQMLMQT_HPP
43 #define ARNQMLMQT_HPP
44 
45 #include "ArnQml.hpp"
46 #include "ArnCompat.hpp"
47 #include <QObject>
48 
49 
50 namespace Arn {
51 
52 class QmlMQtObject : public QObject, public QML_PARSER_STATUS
53 {
54  Q_OBJECT
55 #ifdef QML_Qt4
56  Q_INTERFACES( QDeclarativeParserStatus)
57  Q_PROPERTY( QDeclarativeListProperty<QObject> data READ data DESIGNABLE false)
58 #else
59  Q_INTERFACES( QQmlParserStatus)
60  Q_PROPERTY( QQmlListProperty<QObject> data READ data DESIGNABLE false)
61 #endif
62 
63  Q_PROPERTY( QmlMQtObject* parent READ parentItem WRITE setParentItem NOTIFY parentChanged DESIGNABLE false FINAL)
64 
65  Q_CLASSINFO("DefaultProperty", "data")
66 
67 public:
68  QmlMQtObject( QmlMQtObject* parent = arnNullptr);
69  virtual ~QmlMQtObject();
70 
71  QmlMQtObject* parentItem() const;
73 
74  QML_LIST_PROPERTY<QObject> data();
75  static void data_append( QML_LIST_PROPERTY<QObject>* prop, QObject* obj);
76  static ARN_SIZETYPE data_count( QML_LIST_PROPERTY<QObject>* prop);
77  static QObject* data_at( QML_LIST_PROPERTY<QObject>* prop, ARN_SIZETYPE index);
78  static void data_clear( QML_LIST_PROPERTY<QObject>* prop);
79 
80  virtual void classBegin();
81  virtual void componentComplete();
82 
83 public slots:
84 
85 signals:
86  void parentChanged( QmlMQtObject* obj);
87  void completed();
88 
89 private:
90 };
91 
92 }
93 
94 #endif // ARNQMLMQT_HPP
void parentChanged(QmlMQtObject *obj)
#define ARN_SIZETYPE
Definition: ArnCompat.hpp:75
virtual void componentComplete()
Definition: ArnQmlMQt.cpp:118
static void data_clear(QML_LIST_PROPERTY< QObject > *prop)
Definition: ArnQmlMQt.cpp:103
#define QML_LIST_PROPERTY
Definition: ArnQml.hpp:65
QmlMQtObject parent
Definition: ArnQmlMQt.hpp:63
static QObject * data_at(QML_LIST_PROPERTY< QObject > *prop, ARN_SIZETYPE index)
Definition: ArnQmlMQt.cpp:93
#define QML_PARSER_STATUS
Definition: ArnQml.hpp:63
void setParentItem(QmlMQtObject *parent)
Definition: ArnQmlMQt.cpp:64
static ARN_SIZETYPE data_count(QML_LIST_PROPERTY< QObject > *prop)
Definition: ArnQmlMQt.cpp:86
Definition: Arn.cpp:43
static void data_append(QML_LIST_PROPERTY< QObject > *prop, QObject *obj)
Definition: ArnQmlMQt.cpp:77
QML_LIST_PROPERTY< QObject > data()
virtual void classBegin()
Definition: ArnQmlMQt.cpp:113
QmlMQtObject * parentItem() const
Definition: ArnQmlMQt.cpp:58