Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:07:15

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QABSTRACTPROXYMODEL_H
0005 #define QABSTRACTPROXYMODEL_H
0006 
0007 #include <QtCore/qabstractitemmodel.h>
0008 
0009 QT_REQUIRE_CONFIG(proxymodel);
0010 
0011 QT_BEGIN_NAMESPACE
0012 
0013 class QAbstractProxyModelPrivate;
0014 class QItemSelection;
0015 
0016 class Q_CORE_EXPORT QAbstractProxyModel : public QAbstractItemModel
0017 {
0018     Q_OBJECT
0019     Q_PROPERTY(QAbstractItemModel *sourceModel READ sourceModel WRITE setSourceModel
0020                NOTIFY sourceModelChanged BINDABLE bindableSourceModel)
0021 
0022 public:
0023     explicit QAbstractProxyModel(QObject *parent = nullptr);
0024     ~QAbstractProxyModel();
0025 
0026     virtual void setSourceModel(QAbstractItemModel *sourceModel);
0027     QAbstractItemModel *sourceModel() const;
0028     QBindable<QAbstractItemModel *> bindableSourceModel();
0029 
0030     Q_INVOKABLE virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const = 0;
0031     Q_INVOKABLE virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const = 0;
0032 
0033     Q_INVOKABLE virtual QItemSelection mapSelectionToSource(const QItemSelection &selection) const;
0034     Q_INVOKABLE virtual QItemSelection mapSelectionFromSource(const QItemSelection &selection) const;
0035 
0036     bool submit() override;
0037     void revert() override;
0038 
0039     QVariant data(const QModelIndex &proxyIndex, int role = Qt::DisplayRole) const override;
0040     QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
0041     QMap<int, QVariant> itemData(const QModelIndex &index) const override;
0042     Qt::ItemFlags flags(const QModelIndex &index) const override;
0043 
0044     bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
0045     bool setItemData(const QModelIndex& index, const QMap<int, QVariant> &roles) override;
0046     bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) override;
0047     bool clearItemData(const QModelIndex &index) override;
0048 
0049     QModelIndex buddy(const QModelIndex &index) const override;
0050     bool canFetchMore(const QModelIndex &parent) const override;
0051     void fetchMore(const QModelIndex &parent) override;
0052     void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
0053     QSize span(const QModelIndex &index) const override;
0054     bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
0055     QModelIndex sibling(int row, int column, const QModelIndex &idx) const override;
0056 
0057     QMimeData* mimeData(const QModelIndexList &indexes) const override;
0058     bool canDropMimeData(const QMimeData *data, Qt::DropAction action,
0059                          int row, int column, const QModelIndex &parent) const override;
0060     bool dropMimeData(const QMimeData *data, Qt::DropAction action,
0061                       int row, int column, const QModelIndex &parent) override;
0062     QStringList mimeTypes() const override;
0063     Qt::DropActions supportedDragActions() const override;
0064     Qt::DropActions supportedDropActions() const override;
0065     QHash<int, QByteArray> roleNames() const override;
0066 
0067 Q_SIGNALS:
0068     void sourceModelChanged(QPrivateSignal);
0069 
0070 protected:
0071     QModelIndex createSourceIndex(int row, int col, void *internalPtr) const;
0072     QAbstractProxyModel(QAbstractProxyModelPrivate &, QObject *parent);
0073 
0074 private:
0075     Q_DECLARE_PRIVATE(QAbstractProxyModel)
0076     Q_DISABLE_COPY(QAbstractProxyModel)
0077     Q_PRIVATE_SLOT(d_func(), void _q_sourceModelDestroyed())
0078     Q_PRIVATE_SLOT(d_func(), void _q_sourceModelRowsAboutToBeInserted(QModelIndex, int, int))
0079     Q_PRIVATE_SLOT(d_func(), void _q_sourceModelRowsInserted(QModelIndex, int, int))
0080     Q_PRIVATE_SLOT(d_func(), void _q_sourceModelRowsRemoved(QModelIndex, int, int))
0081     Q_PRIVATE_SLOT(d_func(), void _q_sourceModelColumnsAboutToBeInserted(QModelIndex, int, int))
0082     Q_PRIVATE_SLOT(d_func(), void _q_sourceModelColumnsInserted(QModelIndex, int, int))
0083     Q_PRIVATE_SLOT(d_func(), void _q_sourceModelColumnsRemoved(QModelIndex, int, int))
0084 };
0085 
0086 QT_END_NAMESPACE
0087 
0088 #endif // QABSTRACTPROXYMODEL_H