ENLIGHTEN
Cross-platform desktop GUI for Wasatch Photonics spectrometers
Loading...
Searching...
No Matches
entrylistmodel.h
Go to the documentation of this file.
1
26
27#ifndef ENTRYLISTMODEL_H
28#define ENTRYLISTMODEL_H
29
30#include "entrylistobject.h"
31
32#include <peak/node_map/peak_node_map.hpp>
33
34#include <QAbstractListModel>
35#include <QDebug>
36#include <QMutex>
37#include <QObject>
38
39#include <vector>
40
41class EntryListModel : public QAbstractListModel
42{
43 Q_OBJECT
45 Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
46public:
61
62 EntryListModel() = default;
63 ~EntryListModel() override = default;
64
65 bool operator==(const EntryListModel& other);
66 bool operator!=(const EntryListModel& other);
67
68 int rowCount(const QModelIndex& index = QModelIndex()) const override;
69 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
70 void setNode(const std::shared_ptr<peak::core::nodes::EnumerationNode>& node);
71 Q_INVOKABLE EntryListObject* get(const QString& name);
72 Q_INVOKABLE EntryListObject* get(int index);
73 Q_INVOKABLE QStringList entryDisplayNameList();
75 void setCurrentIndex(int newIndex);
76 bool updateAll();
77 void updateCurrentIndex();
78
79signals:
82
83protected:
84 QHash<int, QByteArray> roleNames() const override;
85
86private:
87 std::shared_ptr<peak::core::nodes::EnumerationNode> m_node;
88 std::vector<std::shared_ptr<EntryListObject>> m_objects{};
89 QStringList m_entryNames{};
90 QStringList m_entryDisplayNames{};
92 mutable QMutex mutex;
93};
94
95#endif // ENTRYLISTMODEL_H
EntryListModel()=default
int currentIndex
Definition entrylistmodel.h:44
Q_INVOKABLE QStringList entryDisplayNameList()
Definition entrylistmodel.cpp:174
void setCurrentIndex(int newIndex)
Definition entrylistmodel.cpp:186
QMutex mutex
Definition entrylistmodel.h:92
void setNode(const std::shared_ptr< peak::core::nodes::EnumerationNode > &node)
Definition entrylistmodel.cpp:109
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Definition entrylistmodel.cpp:71
QStringList m_entryDisplayNames
Definition entrylistmodel.h:90
int currentIndex()
~EntryListModel() override=default
int m_currentIndex
Definition entrylistmodel.h:91
int rowCount(const QModelIndex &index=QModelIndex()) const override
Definition entrylistmodel.cpp:66
std::vector< std::shared_ptr< EntryListObject > > m_objects
Definition entrylistmodel.h:88
bool operator!=(const EntryListModel &other)
Definition entrylistmodel.cpp:61
void countChanged()
QHash< int, QByteArray > roleNames() const override
Definition entrylistmodel.cpp:272
Q_INVOKABLE EntryListObject * get(const QString &name)
Definition entrylistmodel.cpp:144
bool operator==(const EntryListModel &other)
Definition entrylistmodel.cpp:32
void currentIndexChanged()
std::shared_ptr< peak::core::nodes::EnumerationNode > m_node
Definition entrylistmodel.h:87
int count
Definition entrylistmodel.h:45
bool updateAll()
Definition entrylistmodel.cpp:229
void updateCurrentIndex()
Definition entrylistmodel.cpp:289
Roles
Definition entrylistmodel.h:48
@ TooltipRole
Definition entrylistmodel.h:51
@ VisibilityRole
Definition entrylistmodel.h:53
@ AvailableRole
Definition entrylistmodel.h:56
@ AccessStatusRole
Definition entrylistmodel.h:59
@ SymbolicValueRole
Definition entrylistmodel.h:55
@ NameRole
Definition entrylistmodel.h:49
@ WriteableRole
Definition entrylistmodel.h:58
@ DisplayNameRole
Definition entrylistmodel.h:50
@ NumericValueRole
Definition entrylistmodel.h:54
@ ReadableRole
Definition entrylistmodel.h:57
@ DescriptionRole
Definition entrylistmodel.h:52
QStringList m_entryNames
Definition entrylistmodel.h:89
Definition entrylistobject.h:37
The EntryListObject is a prototype for camera property nodes of type "EnumerationEntry"....