// qabstractitemmodel.sip generated by MetaSIP on Fri Apr 16 11:32:08 2010
//
// This file is part of the QtCore Python extension module.
//
// Copyright (c) 2010 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.
// 
// Please review the following information to ensure GNU General
// Public Licensing requirements will be met:
// http://trolltech.com/products/qt/licenses/licensing/opensource/. If
// you are unsure which license is appropriate for your use, please
// review the following information:
// http://trolltech.com/products/qt/licenses/licensing/licensingoverview
// or 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 &);
    ~QModelIndex();
    QModelIndex child(int, int) 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, int) const;
    bool operator==(const QModelIndex &) const;
    bool operator<(const QModelIndex &) const;
    bool operator!=(const QModelIndex &) const;
    long __hash__() const;
%MethodCode
        sipRes = qHash(*sipCpp);
%End
};

class QPersistentModelIndex
{

%TypeHeaderCode
#include <qabstractitemmodel.h>
%End

public:
    QPersistentModelIndex();
    QPersistentModelIndex(const QModelIndex &);
    QPersistentModelIndex(const QPersistentModelIndex &);
    ~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, int) const;
    QModelIndex child(int, int) const;
    const QAbstractItemModel *model() const;
    bool isValid() const;
    operator const QModelIndex &() const;
    bool operator<(const QPersistentModelIndex &) const;
    bool operator==(const QPersistentModelIndex &) const;
    bool operator==(const QModelIndex &) const;
%If (Qt_4_2_0 -)
    bool operator!=(const QPersistentModelIndex &) const;
%End
    bool operator!=(const QModelIndex &) 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, int, const QModelIndex &parent = QModelIndex()) const;
    virtual QModelIndex index(int, int, const QModelIndex &parent = QModelIndex()) const = 0;
    virtual QModelIndex parent(const QModelIndex &) const = 0;
    QObject *parent() const;
    QModelIndex sibling(int, int, const QModelIndex &) 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 &, int role = Qt::DisplayRole) const = 0;
    virtual bool setData(const QModelIndex &, const QVariant &, int role = Qt::EditRole);
    virtual QVariant headerData(int, Qt::Orientation, int role = Qt::DisplayRole) const;
    virtual bool setHeaderData(int, Qt::Orientation, const QVariant &, int role = Qt::EditRole);
    virtual QMap<int,QVariant> itemData(const QModelIndex &) const /DocType="Py_v3:dict-of-int-object;dict-of-int-QVariant"/;
    virtual bool setItemData(const QModelIndex &, const QMap<int,QVariant> & /DocType="Py_v3:dict-of-int-object;dict-of-int-QVariant"/);
    virtual QStringList mimeTypes() const;
    virtual QMimeData *mimeData(const QModelIndexList &) const /TransferBack/;
    virtual bool dropMimeData(const QMimeData *, Qt::DropAction, int, int, const QModelIndex &);
    virtual Qt::DropActions supportedDropActions() const;
    virtual bool insertRows(int, int, const QModelIndex &parent = QModelIndex());
    virtual bool insertColumns(int, int, const QModelIndex &parent = QModelIndex());
    virtual bool removeRows(int, int, const QModelIndex &parent = QModelIndex());
    virtual bool removeColumns(int, int, const QModelIndex &parent = QModelIndex());
    virtual void fetchMore(const QModelIndex &);
    virtual bool canFetchMore(const QModelIndex &) const;
    virtual Qt::ItemFlags flags(const QModelIndex &) const;
    virtual void sort(int, Qt::SortOrder order = Qt::AscendingOrder);
    virtual QModelIndex buddy(const QModelIndex &) const;
    virtual QModelIndexList match(const QModelIndex &, int, const QVariant &, int hits = 1, Qt::MatchFlags flags = Qt::MatchStartsWith|Qt::MatchWrap) const;
    virtual QSize span(const QModelIndex &) const;

signals:
    void dataChanged(const QModelIndex &, const QModelIndex &);
    void headerDataChanged(Qt::Orientation, int, int);
%If (Qt_4_2_0 -)
    void layoutAboutToBeChanged();
%End
    void layoutChanged();
    void rowsAboutToBeInserted(const QModelIndex &, int, int);
    void rowsInserted(const QModelIndex &, int, int);
    void rowsAboutToBeRemoved(const QModelIndex &, int, int);
    void rowsRemoved(const QModelIndex &, int, int);
    void columnsAboutToBeInserted(const QModelIndex &, int, int);
    void columnsInserted(const QModelIndex &, int, int);
    void columnsAboutToBeRemoved(const QModelIndex &, int, int);
    void columnsRemoved(const QModelIndex &, int, int);
%If (Qt_4_2_0 -)
    void modelAboutToBeReset();
%End
    void modelReset();

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

protected:
    void encodeData(const QModelIndexList &, QDataStream &) const;
    bool decodeData(int, int, const QModelIndex &, QDataStream &);
    void beginInsertRows(const QModelIndex &, int, int);
    void endInsertRows();
    void beginRemoveRows(const QModelIndex &, int, int);
    void endRemoveRows();
    void beginInsertColumns(const QModelIndex &, int, int);
    void endInsertColumns();
    void beginRemoveColumns(const QModelIndex &, int, int);
    void endRemoveColumns();
%If (Qt_4_2_0 -)
    QModelIndexList persistentIndexList() const;
%End
    void reset();
    void changePersistentIndex(const QModelIndex &, const QModelIndex &);
    void changePersistentIndexList(const QModelIndexList &, const QModelIndexList &);

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

protected:
    QModelIndex createIndex(int, int, 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 -)
    void rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int);
%End
%If (Qt_4_6_0 -)
    void rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int);
%End
%If (Qt_4_6_0 -)
    void columnsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int);
%End
%If (Qt_4_6_0 -)
    void columnsMoved(const QModelIndex &, int, int, const QModelIndex &, int);
%End

protected:
%If (Qt_4_6_0 -)
    bool beginMoveRows(const QModelIndex &, int, int, const QModelIndex &, int);
%End
%If (Qt_4_6_0 -)
    void endMoveRows();
%End
%If (Qt_4_6_0 -)
    bool beginMoveColumns(const QModelIndex &, int, int, const QModelIndex &, int);
%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> &);
%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, int, const QModelIndex &parent = QModelIndex()) const;
    virtual bool dropMimeData(const QMimeData *, Qt::DropAction, int, int, const QModelIndex &);

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

class QAbstractListModel : QAbstractItemModel
{

%TypeHeaderCode
#include <qabstractitemmodel.h>
%End

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

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