qsqltablemodel.sip 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // qsqltablemodel.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtSql 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 QSqlTableModel : public QSqlQueryModel
  22. {
  23. %TypeHeaderCode
  24. #include <qsqltablemodel.h>
  25. %End
  26. public:
  27. enum EditStrategy
  28. {
  29. OnFieldChange,
  30. OnRowChange,
  31. OnManualSubmit,
  32. };
  33. QSqlTableModel(QObject *parent /TransferThis/ = 0, const QSqlDatabase &db = QSqlDatabase());
  34. virtual ~QSqlTableModel();
  35. virtual bool select();
  36. virtual void setTable(const QString &tableName);
  37. QString tableName() const;
  38. virtual Qt::ItemFlags flags(const QModelIndex &index) const;
  39. virtual QVariant data(const QModelIndex &idx, int role = Qt::DisplayRole) const;
  40. virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
  41. virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
  42. bool isDirty(const QModelIndex &index) const;
  43. bool isDirty() const;
  44. virtual void clear();
  45. virtual void setEditStrategy(QSqlTableModel::EditStrategy strategy);
  46. QSqlTableModel::EditStrategy editStrategy() const;
  47. QSqlIndex primaryKey() const;
  48. QSqlDatabase database() const;
  49. int fieldIndex(const QString &fieldName) const;
  50. virtual void sort(int column, Qt::SortOrder order);
  51. virtual void setSort(int column, Qt::SortOrder order);
  52. QString filter() const;
  53. virtual void setFilter(const QString &filter);
  54. virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
  55. virtual bool removeColumns(int column, int count, const QModelIndex &parent = QModelIndex());
  56. virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
  57. virtual bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
  58. bool insertRecord(int row, const QSqlRecord &record);
  59. bool setRecord(int row, const QSqlRecord &record);
  60. virtual void revertRow(int row);
  61. public slots:
  62. virtual bool submit();
  63. virtual void revert();
  64. bool submitAll();
  65. void revertAll();
  66. signals:
  67. void primeInsert(int row, QSqlRecord &record);
  68. void beforeInsert(QSqlRecord &record);
  69. void beforeUpdate(int row, QSqlRecord &record);
  70. void beforeDelete(int row);
  71. protected:
  72. virtual bool updateRowInTable(int row, const QSqlRecord &values);
  73. virtual bool insertRowIntoTable(const QSqlRecord &values);
  74. virtual bool deleteRowFromTable(int row);
  75. virtual QString orderByClause() const;
  76. virtual QString selectStatement() const;
  77. void setPrimaryKey(const QSqlIndex &key);
  78. %If (- Qt_6_5_0)
  79. void setQuery(const QSqlQuery &query);
  80. %End
  81. virtual QModelIndex indexInQuery(const QModelIndex &item) const;
  82. QSqlRecord primaryValues(int row) const;
  83. public:
  84. virtual bool selectRow(int row);
  85. QSqlRecord record() const;
  86. QSqlRecord record(int row) const;
  87. virtual bool clearItemData(const QModelIndex &index);
  88. };