qaugmentedrealitycameramodel.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef QAUGMENTEDREALITYCAMERAMODEL_H
  2. #define QAUGMENTEDREALITYCAMERAMODEL_H
  3. #include <QAbstractListModel>
  4. #include <QDeclarativeListProperty>
  5. #include "qdll_global.h"
  6. #include "qaugmentedrealitycameraitem.h"
  7. class QDLLSHARED_EXPORT QAugmentedRealityCameraModel : public QAbstractListModel
  8. {
  9. Q_OBJECT
  10. Q_CLASSINFO("Author", "Sebastiano Galazzo")
  11. Q_CLASSINFO("Email", "sebastiano.galazzo@gmail.com")
  12. Q_PROPERTY(QDeclarativeListProperty<QAugmentedRealityCameraItem> pins READ pins)
  13. public:
  14. explicit QAugmentedRealityCameraModel(QObject* parent = 0);
  15. ~QAugmentedRealityCameraModel();
  16. int rowCount(const QModelIndex &parent = QModelIndex()) const;
  17. QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
  18. QHash<int, QByteArray> roleNames() const;
  19. Q_INVOKABLE void append(QVariantMap item);
  20. void appendRow(QAugmentedRealityCameraItem* item);
  21. void appendRows(const QList<QAugmentedRealityCameraItem*> &items);
  22. void insertRow(int row, QAugmentedRealityCameraItem* item);
  23. bool removeRow(int row, const QModelIndex &parent = QModelIndex());
  24. bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
  25. QAugmentedRealityCameraItem* at(int row);
  26. QAugmentedRealityCameraItem* takeRow(int row);
  27. QAugmentedRealityCameraItem* find(const QString &id) const;
  28. QModelIndex indexFromItem( const QAugmentedRealityCameraItem* item) const;
  29. void clear();
  30. QDeclarativeListProperty<QAugmentedRealityCameraItem> pins();
  31. private slots:
  32. void handleItemChange();
  33. private:
  34. QAugmentedRealityCameraItem* m_prototype;
  35. QList<QAugmentedRealityCameraItem*> m_list;
  36. };
  37. #endif // QAUGMENTEDREALITYCAMERAMODEL_H