qconcatenatetablesproxymodel.sip 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // qconcatenatetablesproxymodel.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtCore Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  8. //
  9. // This file may be used under the terms of the GNU General Public License
  10. // version 3.0 as published by the Free Software Foundation and appearing in
  11. // the file LICENSE included in the packaging of this file. Please review the
  12. // following information to ensure the GNU General Public License version 3.0
  13. // requirements will be met: http://www.gnu.org/copyleft/gpl.html.
  14. //
  15. // If you do not wish to use this file under the terms of the GPL version 3.0
  16. // then you may purchase a commercial license. For more information contact
  17. // info@riverbankcomputing.com.
  18. //
  19. // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  20. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21. class QConcatenateTablesProxyModel : public QAbstractItemModel
  22. {
  23. %TypeHeaderCode
  24. #include <qconcatenatetablesproxymodel.h>
  25. %End
  26. public:
  27. explicit QConcatenateTablesProxyModel(QObject *parent /TransferThis/ = 0);
  28. virtual ~QConcatenateTablesProxyModel();
  29. void addSourceModel(QAbstractItemModel *sourceModel /GetWrapper/);
  30. %MethodCode
  31. // We want to keep a reference to the model but this is in addition to the
  32. // existing ones and does not replace them - so we can't use /KeepReference/.
  33. sipCpp->addSourceModel(a0);
  34. // Use the user object as a list of the references.
  35. PyObject *user = sipGetUserObject((sipSimpleWrapper *)sipSelf);
  36. if (!user)
  37. {
  38. user = PyList_New(0);
  39. sipSetUserObject((sipSimpleWrapper *)sipSelf, user);
  40. }
  41. if (user)
  42. PyList_Append(user, a0Wrapper);
  43. %End
  44. void removeSourceModel(QAbstractItemModel *sourceModel /GetWrapper/);
  45. %MethodCode
  46. // Discard the extra model reference that we took in addSourceModel().
  47. sipCpp->removeSourceModel(a0);
  48. // Use the user object as a list of the references.
  49. PyObject *user = sipGetUserObject((sipSimpleWrapper *)sipSelf);
  50. if (user)
  51. {
  52. Py_ssize_t i = 0;
  53. // Note that we deal with an object appearing in the list more than once.
  54. while (i < PyList_Size(user))
  55. if (PyList_GetItem(user, i) == a0Wrapper)
  56. PyList_SetSlice(user, i, i + 1, NULL);
  57. else
  58. ++i;
  59. }
  60. %End
  61. QModelIndex mapFromSource(const QModelIndex &sourceIndex) const;
  62. QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
  63. virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
  64. virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
  65. virtual QMap<int, QVariant> itemData(const QModelIndex &proxyIndex) const;
  66. virtual bool setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles);
  67. virtual Qt::ItemFlags flags(const QModelIndex &index) const;
  68. virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
  69. virtual QModelIndex parent(const QModelIndex &index) const;
  70. virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
  71. virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
  72. virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
  73. virtual QStringList mimeTypes() const;
  74. virtual QMimeData *mimeData(const QModelIndexList &indexes) const /TransferBack/;
  75. virtual bool canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const;
  76. virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
  77. virtual QSize span(const QModelIndex &index) const;
  78. QList<QAbstractItemModel *> sourceModels() const;
  79. %If (Qt_6_9_0 -)
  80. virtual QHash<int, QByteArray> roleNames() const;
  81. %End
  82. };