File indexing completed on 2024-04-28 17:02:35

0001 /* generated by rust_qt_binding_generator */
0002 #ifndef BINDINGS_H
0003 #define BINDINGS_H
0004 
0005 #include <QtCore/QObject>
0006 #include <QtCore/QAbstractItemModel>
0007 
0008 class Todos;
0009 
0010 class Todos : public QAbstractItemModel
0011 {
0012     Q_OBJECT
0013 public:
0014     class Private;
0015 private:
0016     Private * m_d;
0017     bool m_ownsPrivate;
0018     Q_PROPERTY(quint64 activeCount READ activeCount NOTIFY activeCountChanged FINAL)
0019     Q_PROPERTY(quint64 count READ count NOTIFY countChanged FINAL)
0020     explicit Todos(bool owned, QObject *parent);
0021 public:
0022     explicit Todos(QObject *parent = nullptr);
0023     ~Todos();
0024     quint64 activeCount() const;
0025     quint64 count() const;
0026     Q_INVOKABLE void add(const QString& description);
0027     Q_INVOKABLE void clearCompleted();
0028     Q_INVOKABLE bool remove(quint64 index);
0029     Q_INVOKABLE void setAll(bool completed);
0030 
0031     int columnCount(const QModelIndex &parent = QModelIndex()) const override;
0032     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
0033     QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
0034     QModelIndex parent(const QModelIndex &index) const override;
0035     bool hasChildren(const QModelIndex &parent = QModelIndex()) const override;
0036     int rowCount(const QModelIndex &parent = QModelIndex()) const override;
0037     bool canFetchMore(const QModelIndex &parent) const override;
0038     void fetchMore(const QModelIndex &parent) override;
0039     Qt::ItemFlags flags(const QModelIndex &index) const override;
0040     void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
0041     int role(const char* name) const;
0042     QHash<int, QByteArray> roleNames() const override;
0043     QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
0044     bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) override;
0045     Q_INVOKABLE bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
0046     Q_INVOKABLE bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
0047     bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
0048     Q_INVOKABLE bool completed(int row) const;
0049     Q_INVOKABLE bool setCompleted(int row, bool value);
0050     Q_INVOKABLE QString description(int row) const;
0051     Q_INVOKABLE bool setDescription(int row, const QString& value);
0052 
0053 Q_SIGNALS:
0054     // new data is ready to be made available to the model with fetchMore()
0055     void newDataReady(const QModelIndex &parent) const;
0056 private:
0057     QHash<QPair<int,Qt::ItemDataRole>, QVariant> m_headerData;
0058     void initHeaderData();
0059     void updatePersistentIndexes();
0060 Q_SIGNALS:
0061     void activeCountChanged();
0062     void countChanged();
0063 };
0064 #endif // BINDINGS_H