File: qabstractitemmodel.sip

package info (click to toggle)
python-qt4 4.9.3-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 34,432 kB
  • sloc: python: 34,126; cpp: 11,938; xml: 290; makefile: 223; php: 27
file content (384 lines) | stat: -rw-r--r-- 14,593 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
// qabstractitemmodel.sip generated by MetaSIP on Sun Jun 24 12:29:11 2012
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2012 Riverbank Computing Limited <info@riverbankcomputing.com>
// 
// This file is part of PyQt.
// 
// This file may be used under the terms of the GNU General Public
// License versions 2.0 or 3.0 as published by the Free Software
// Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
// included in the packaging of this file.  Alternatively you may (at
// your option) use any later version of the GNU General Public
// License if such license has been publicly approved by Riverbank
// Computing Limited (or its successors, if any) and the KDE Free Qt
// Foundation. In addition, as a special exception, Riverbank gives you
// certain additional rights. These rights are described in the Riverbank
// GPL Exception version 1.1, which can be found in the file
// GPL_EXCEPTION.txt in this package.
// 
// If you are unsure which license is appropriate for your use, please
// contact the sales department at sales@riverbankcomputing.com.
// 
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.


class QModelIndex
{
%TypeHeaderCode
#include <qabstractitemmodel.h>
%End

public:
    QModelIndex();
    QModelIndex(const QModelIndex &other);
    ~QModelIndex();
    QModelIndex child(int arow, int acolumn) const;
    int row() const;
    int column() const;
    QVariant data(int role = Qt::DisplayRole) const;
%If (Qt_4_2_0 -)
    Qt::ItemFlags flags() const;
%End
    SIP_PYOBJECT internalPointer() const;
%MethodCode
        sipRes = reinterpret_cast<PyObject *>(sipCpp->internalPointer());
        
        if (!sipRes)
            sipRes = Py_None;
        
        Py_INCREF(sipRes);
%End

    SIP_PYOBJECT internalId() const /DocType="int"/;
%MethodCode
        // Python needs to treat the result as an unsigned value (which may not happen
        // on 64 bit systems).  Instead we get the real value as it is stored (as a
        // void *) and let Python convert that.
        sipRes = PyLong_FromVoidPtr(sipCpp->internalPointer());
%End

    const QAbstractItemModel *model() const;
    bool isValid() const;
    QModelIndex parent() const;
    QModelIndex sibling(int arow, int acolumn) const;
    bool operator==(const QModelIndex &other) const;
    bool operator<(const QModelIndex &other) const;
    bool operator!=(const QModelIndex &other) const;
    long __hash__() const;
%MethodCode
        sipRes = qHash(*sipCpp);
%End
};

class QPersistentModelIndex
{
%TypeHeaderCode
#include <qabstractitemmodel.h>
%End

public:
    QPersistentModelIndex();
    QPersistentModelIndex(const QModelIndex &index);
    QPersistentModelIndex(const QPersistentModelIndex &other);
    ~QPersistentModelIndex();
    int row() const;
    int column() const;
    QVariant data(int role = Qt::DisplayRole) const;
%If (Qt_4_2_0 -)
    Qt::ItemFlags flags() const;
%End
    QModelIndex parent() const;
    QModelIndex sibling(int row, int column) const;
    QModelIndex child(int row, int column) const;
    const QAbstractItemModel *model() const;
    bool isValid() const;
    operator const QModelIndex &() const;
    bool operator<(const QPersistentModelIndex &other) const;
    bool operator==(const QPersistentModelIndex &other) const;
    bool operator==(const QModelIndex &other) const;
%If (Qt_4_2_0 -)
    bool operator!=(const QPersistentModelIndex &other) const;
%End
    bool operator!=(const QModelIndex &other) const;
%If (Qt_4_5_0 -)
    long __hash__() const;
%MethodCode
        sipRes = qHash(*sipCpp);
%End

%End
};

typedef QList<QModelIndex> QModelIndexList;

class QAbstractItemModel : QObject
{
%TypeHeaderCode
#include <qabstractitemmodel.h>
%End

public:
    explicit QAbstractItemModel(QObject *parent /TransferThis/ = 0);
    virtual ~QAbstractItemModel();
    bool hasIndex(int row, int column, const QModelIndex &parent = QModelIndex()) const;
    virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const = 0;
    virtual QModelIndex parent(const QModelIndex &child) const = 0;
    QObject *parent() const;
    QModelIndex sibling(int row, int column, const QModelIndex &idx) const;
    virtual int rowCount(const QModelIndex &parent = QModelIndex()) const = 0;
    virtual int columnCount(const QModelIndex &parent = QModelIndex()) const = 0;
    virtual bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
    virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const = 0;
    virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
    virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
    virtual bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole);
    virtual QMap<int, QVariant> itemData(const QModelIndex &index) const /DocType="Py_v3:dict-of-int-object;dict-of-int-QVariant"/;
    virtual bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles /DocType="Py_v3:dict-of-int-object;dict-of-int-QVariant"/);
    virtual QStringList mimeTypes() const;
    virtual QMimeData *mimeData(const QModelIndexList &indexes) const /TransferBack/;
    virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
    virtual Qt::DropActions supportedDropActions() const;
    virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
    virtual bool insertColumns(int column, int count, const QModelIndex &parent = QModelIndex());
    virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
    virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex());
    virtual void fetchMore(const QModelIndex &parent);
    virtual bool canFetchMore(const QModelIndex &parent) const;
    virtual Qt::ItemFlags flags(const QModelIndex &index) const;
    virtual void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
    virtual QModelIndex buddy(const QModelIndex &index) const;
    virtual QModelIndexList match(const QModelIndex &start, int role, const QVariant &value, int hits = 1, Qt::MatchFlags flags = Qt::MatchStartsWith|Qt::MatchWrap) const;
    virtual QSize span(const QModelIndex &index) const;

signals:
%If (Qt_5_0_0 -)
    void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QSet<int> &roles = QSet<int>());
%End
%If (- Qt_5_0_0)
    void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
%End
    void headerDataChanged(Qt::Orientation orientation, int first, int last);
%If (Qt_5_0_0 -)
    void layoutAboutToBeChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>());
%End
%If (Qt_4_2_0 - Qt_5_0_0)
    void layoutAboutToBeChanged();
%End
%If (Qt_5_0_0 -)
    void layoutChanged(const QList<QPersistentModelIndex> &parents = QList<QPersistentModelIndex>());
%End
%If (- Qt_5_0_0)
    void layoutChanged();
%End
%If (- Qt_5_0_0)
    void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last);
%End
%If (- Qt_5_0_0)
    void rowsInserted(const QModelIndex &parent, int first, int last);
%End
%If (- Qt_5_0_0)
    void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int last);
%End
%If (- Qt_5_0_0)
    void rowsRemoved(const QModelIndex &parent, int first, int last);
%End
%If (- Qt_5_0_0)
    void columnsAboutToBeInserted(const QModelIndex &parent, int first, int last);
%End
%If (- Qt_5_0_0)
    void columnsInserted(const QModelIndex &parent, int first, int last);
%End
%If (- Qt_5_0_0)
    void columnsAboutToBeRemoved(const QModelIndex &parent, int first, int last);
%End
%If (- Qt_5_0_0)
    void columnsRemoved(const QModelIndex &parent, int first, int last);
%End
%If (Qt_4_2_0 - Qt_5_0_0)
    void modelAboutToBeReset();
%End
%If (- Qt_5_0_0)
    void modelReset();
%End

public slots:
    virtual bool submit();
    virtual void revert();

protected slots:
%If (Qt_4_8_0 - Qt_5_0_0)
    void resetInternalData();
%End

protected:
    void encodeData(const QModelIndexList &indexes, QDataStream &stream) const;
    bool decodeData(int row, int column, const QModelIndex &parent, QDataStream &stream);
    void beginInsertRows(const QModelIndex &parent, int first, int last);
    void endInsertRows();
    void beginRemoveRows(const QModelIndex &parent, int first, int last);
    void endRemoveRows();
    void beginInsertColumns(const QModelIndex &parent, int first, int last);
    void endInsertColumns();
    void beginRemoveColumns(const QModelIndex &parent, int first, int last);
    void endRemoveColumns();
%If (Qt_4_2_0 -)
    QModelIndexList persistentIndexList() const;
%End
    void reset();
    void changePersistentIndex(const QModelIndex &from, const QModelIndex &to);
    void changePersistentIndexList(const QModelIndexList &from, const QModelIndexList &to);

public:
    bool insertRow(int row, const QModelIndex &parent = QModelIndex());
    bool insertColumn(int column, const QModelIndex &parent = QModelIndex());
    bool removeRow(int row, const QModelIndex &parent = QModelIndex());
    bool removeColumn(int column, const QModelIndex &parent = QModelIndex());
%If (Qt_4_2_0 -)
    void setSupportedDragActions(Qt::DropActions);
%End
%If (Qt_5_0_0 -)
    virtual Qt::DropActions supportedDragActions() const;
%End
%If (Qt_4_2_0 - Qt_5_0_0)
    Qt::DropActions supportedDragActions() const;
%End
%If (Qt_5_0_0 -)
    virtual QHash<int, QByteArray> roleNames() const;
%End
%If (Qt_4_6_0 - Qt_5_0_0)
    const QHash<int, QByteArray> &roleNames() const;
%End

protected:
    QModelIndex createIndex(int row, int column, SIP_PYOBJECT object = 0) const [QModelIndex (int row, int column, void *object = 0)];
%MethodCode
        // The Qt API is broken (and won't be fixed as it would break binary
        // compatibility) regarding the internal id of a model index on different
        // architectures (32 vs 64 bits).  We choose to work around the breakage as it
        // is fairly subtle and continues to catch people out.  Instead of letting Qt
        // convert betweed an integer id and a pointer id (the internal format used by
        // Qt) we let Python do it.
        
        void *ptr;
        
        if (a2)
        {
            // Try and convert it to a Python long and fallback to the object's
            // address if it fails.
            ptr = PyLong_AsVoidPtr(a2);
        
            if (PyErr_Occurred())
            {
                PyErr_Clear();
                ptr = a2;
            }
        }
        else
        {
            ptr = 0;
        }
        
        #if defined(SIP_PROTECTED_IS_PUBLIC)
        sipRes = new QModelIndex(sipCpp->createIndex(a0, a1, ptr));
        #else
        sipRes = new QModelIndex(sipCpp->sipProtect_createIndex(a0, a1, ptr));
        #endif
%End

signals:
%If (Qt_4_6_0 - Qt_5_0_0)
    void rowsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationRow);
%End
%If (Qt_4_6_0 - Qt_5_0_0)
    void rowsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int row);
%End
%If (Qt_4_6_0 - Qt_5_0_0)
    void columnsAboutToBeMoved(const QModelIndex &sourceParent, int sourceStart, int sourceEnd, const QModelIndex &destinationParent, int destinationColumn);
%End
%If (Qt_4_6_0 - Qt_5_0_0)
    void columnsMoved(const QModelIndex &parent, int start, int end, const QModelIndex &destination, int column);
%End

protected:
%If (Qt_4_6_0 -)
    bool beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationRow);
%End
%If (Qt_4_6_0 -)
    void endMoveRows();
%End
%If (Qt_4_6_0 -)
    bool beginMoveColumns(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationColumn);
%End
%If (Qt_4_6_0 -)
    void endMoveColumns();
%End
%If (Qt_4_6_0 -)
    void beginResetModel();
%End
%If (Qt_4_6_0 -)
    void endResetModel();
%End
%If (Qt_4_6_0 -)
    void setRoleNames(const QHash<int, QByteArray> &roleNames);
%End

public:
%If (Qt_5_0_0 -)
    virtual bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const;
%End
%If (Qt_5_0_0 -)
    virtual bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild);
%End
%If (Qt_5_0_0 -)
    virtual bool moveColumns(const QModelIndex &sourceParent, int sourceColumn, int count, const QModelIndex &destinationParent, int destinationChild);
%End
%If (Qt_5_0_0 -)
    bool moveRow(const QModelIndex &sourceParent, int sourceRow, const QModelIndex &destinationParent, int destinationChild);
%End
%If (Qt_5_0_0 -)
    bool moveColumn(const QModelIndex &sourceParent, int sourceColumn, const QModelIndex &destinationParent, int destinationChild);
%End

private:
    QAbstractItemModel(const QAbstractItemModel &);
};

class QAbstractTableModel : QAbstractItemModel
{
%TypeHeaderCode
#include <qabstractitemmodel.h>
%End

public:
    explicit QAbstractTableModel(QObject *parent /TransferThis/ = 0);
    virtual ~QAbstractTableModel();
    virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
    virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);

private:
    QAbstractTableModel(const QAbstractTableModel &);
    virtual QModelIndex parent(const QModelIndex &child) const;
    virtual bool hasChildren(const QModelIndex &parent) const;
};

class QAbstractListModel : QAbstractItemModel
{
%TypeHeaderCode
#include <qabstractitemmodel.h>
%End

public:
    explicit QAbstractListModel(QObject *parent /TransferThis/ = 0);
    virtual ~QAbstractListModel();
    virtual QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
    virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);

private:
    QAbstractListModel(const QAbstractListModel &);
    virtual QModelIndex parent(const QModelIndex &child) const;
    virtual int columnCount(const QModelIndex &parent) const;
    virtual bool hasChildren(const QModelIndex &parent) const;
};