1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
42 #ifndef QSGVISUALADAPTORMODEL_P_H
43 #define QSGVISUALADAPTORMODEL_P_H
45 #include <QtCore/qobject.h>
46 #include <QtCore/qabstractitemmodel.h>
48 #include <private/qdeclarativerefcount_p.h>
54 class QDeclarativeEngine;
56 class QSGVisualAdaptorModelPrivate;
57 class QSGVisualAdaptorModel : public QObject
60 Q_DECLARE_PRIVATE(QSGVisualAdaptorModel)
64 MetaObjectCacheable = 0x01,
67 Q_DECLARE_FLAGS(Flags, Flag)
69 QSGVisualAdaptorModel(QObject *parent = 0);
70 virtual ~QSGVisualAdaptorModel();
74 QVariant model() const;
75 void setModel(const QVariant &, QDeclarativeEngine *);
77 QVariant rootIndex() const;
78 void setRootIndex(const QVariant &root);
80 QVariant modelIndex(int idx) const;
81 QVariant parentModelIndex() const;
84 QObject *data(int index);
85 QString stringValue(int index, const QString &role);
86 void replaceWatchedRoles(const QList<QByteArray> &oldRoles, const QList<QByteArray> &newRoles);
87 int indexOf(QObject *object) const;
89 bool canFetchMore() const;
93 void rootIndexChanged();
94 void modelReset(int oldCount, int newCount);
96 void itemsInserted(int index, int count);
97 void itemsRemoved(int index, int count);
98 void itemsMoved(int from, int to, int count);
99 void itemsChanged(int index, int count);
102 void _q_itemsChanged(int, int, const QList<int> &);
103 void _q_itemsInserted(int index, int count);
104 void _q_itemsRemoved(int index, int count);
105 void _q_itemsMoved(int from, int to, int count);
106 void _q_rowsInserted(const QModelIndex &,int,int);
107 void _q_rowsRemoved(const QModelIndex &,int,int);
108 void _q_rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int);
109 void _q_dataChanged(const QModelIndex&,const QModelIndex&);
110 void _q_layoutChanged();
111 void _q_modelReset();
114 Q_DISABLE_COPY(QSGVisualAdaptorModel)
117 class QSGVisualAdaptorModelProxyInterface
120 virtual ~QSGVisualAdaptorModelProxyInterface() {}
122 virtual QObject *proxiedObject() = 0;
125 Q_DECLARE_INTERFACE(QSGVisualAdaptorModelProxyInterface, "com.trolltech.qml.QSGVisualAdaptorModelProxyInterface")